JDCC '15 Contest 2 P1 - Lifting Weights

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

Lily has decided that she needs to exercise and has started to lift weights. During her first week of exercising, she was capable of lifting some weight A. However, as she grew stronger, she was able to lift B more kilograms than she could the week before.

Figure out how much weight Lily was able to lift after N weeks.

Input Specification

The first line of input provides the number of test cases, T (1 \le T \le 100). T test cases follow. Each test case consists of one line containing three integers A, B, N (1 \le A, B, N \le 100).

Output Specification

For each test case, your program should output one integer, how much she should be able to lift.

Sample Input

2 2 1
2 3 4

Sample Output


Explanation for Sample

In the second test case, she was able to lift 2 kilograms in her first week, 5 in her second, 8 in her third, and 11 in her fourth.


There are no comments at the moment.