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 $$N th$$ 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 $$N$$th term.
Output Format:
Output will contain the number denoting the $$N$$th term.
Constraints:
1\(\le\)$$N$$\(\le\)108
-109\(\le \)$$A$$,$$B$$\(\le\)109
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial