Special-Sequence

0

0 votes
Easy
Problem

Everyone of us knows that sahil is very good in maths, so this time Prince give him a problem of Math.The problem is that there is a special sequence whose first and second term is given and sahil have to find the Nth term of the sequence.

Special sequence have a property that the value of any term is average of its next and previous term.

Since sahil is busy in gym so he asked you to solve this problem.

Note: Since output can be very large so you have to print the answer by taking modulus with 1000000007.

Input Format:

First line contain the three integer A, B  and N denoting the first and second term and N represent that you have to find the Nth term.

Output Format:

Output will contain the number denoting the Nth term.

Constraints:

1N108

-109A,B109

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?