13647 - Reverse Fibonacci numbers   

Description

In mathematics, the Fibonacci numbers can be defined by the recurrence relation:

For example, if n = 3, the corresponding result will be 3.

 

Here, we want to find the reverse Fibonacci numbers defined by a similar but different recurrence relation:

For example, if G0 = 1, G1=-1, the reverse Fibonacci sequence will be like: 1,-1,2,-3,5,-8, ....

 

In this problem, given G0, G1, and n, please calculate Gn.

Input

There will be three integers(G0, G1, and n) separated by white space.

Note: ( -100000 <=G0G1<= 100000) and (0 <= n <= 30)

Output

The nth number, Gn,  in the reverse Fibonacci number.

Note that you need to print "\n" at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss