logo AlgoBeat OnlineJudge
登录 注册

#216955. [ICPC 2017 Qingdao R] Collecting Cents

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You have cents at the beginning, and there is a bank that accepts time deposits of your cents.

The time is measured in years and the interest rate is all the time. That is, if you make a time deposit of cents for years (both and must be integers), then after years, you can get back cents from the bank, where is the largest integer that is less or equal to . If you make multiple deposits, the interest of each deposit will be calculated independently.

You want to find the best strategy to deposit your cents such that the amount of cents you will own is maximized after years.

输入格式

The first line is the number of test cases up to 120. For each test case, there are three integers , and (, , , ).

输出格式

For each test case, output the maximum number of cents you will own after years.

样例

样例输入 1

3
3 2 4
5 6 5
1 1 63

样例输出 1

14
10
9223372036854775808