How to solve this..in without using inner for loop...?

Q) Given a pair (a,b). After,each unit of time ,the pair gets modified to (b-a,a+b). U are given the initial value of pair and an integer n and you have to print the value of pair at the nth unit of time.

INPUT → t denoting no of test cases
a,b,n
Output → For each test cases print two integers mod 10^9+7 (a,b).

1<=t <= 10^5
0<=a <=b <= 10^9
1<=n <= 10^9

SAMPLE INPUT

5
1 3 5
2 3 9
3 13 28
42 999 1881
4 97 43

SAMPLE OUTPUT
4 12
32 48
81920 131072
728771468 762921230
8388608 203423744

Here.

1 Like

thanks

CHECK THIS!!

code

1 Like