New update is available. Click here to update.

Last Updated: 23 Oct, 2020

Difficulty: Easy

```
The series is 1-based indexed.
```

```
The first line contains an integer T denoting the number of test cases. Then each test case follows.
The first line of each test case contains three space-separated integers ‘X’, 'Y', and ‘N’, respectively where ‘X’ and ‘Y’ represent the first and second element of the series while N represents which number of the sequence we have to find out.
```

```
For each test case, print a single line containing a single integer denoting the Nth number of the series.
The output of each test case will be printed in separate lines.
```

```
You are not required to print the expected output; it has already been taken care of. Just implement the given function.
```

```
1 <= T <= 100
1 <= N <= 10 ^ 18
-10 ^ 6 <= X, Y <= 10 ^ 6
Time limit: 1 sec.
```

SIMILAR PROBLEMS

NINJA AND HAPPINESS

Posted: 9 Sep, 2022

Difficulty: Hard

DECODE STRING

Posted: 11 Sep, 2022

Difficulty: Moderate

Randomly Sorted

Posted: 13 Nov, 2022

Difficulty: Moderate

Merge Two Sorted Arrays Without Extra Space

Posted: 19 Nov, 2022

Difficulty: Moderate

Co-Prime

Posted: 14 Dec, 2022

Difficulty: Hard

Popular Interview Problems: