| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 260 | 107 | 68 | 33.831% |
Malvika was getting bored of the usual Fibonacci problems, and decided to add a little twist to it. She defined a new function f() with the following properties:
She'll give an integer N, and you have to find out what f(N) is. Output the answers modulo 109+7.
The first line of input contains a single integer T denoting number of test cases.
The only line of each test case contains three integers: A, B and N, denoting f(1), f(2) and the query.
For each test case, output a line which contains a single integer, corresponding to f(N) for the given input.
2 10 17 3 23 17 3
7 1000000001
In the first test case, f(3) = 7, and so that is the output.
In the second test case, f(3) = -6 and the answer modulo 109+7 is 1000000001.