A9482. Jzzhu and Sequences
编程题
普及/提高-
知识点
题目描述
Jzzhu has invented a kind of sequences, they meet the following property:
You are given $x$ and $y$ , please calculate $f_{n}$ modulo $1000000007$ $(10^{9}+7)$ .
You are given $x$ and $y$ , please calculate $f_{n}$ modulo $1000000007$ $(10^{9}+7)$ .
输入格式
The first line contains two integers $x$ and $y$ $(|x|,|y|<=10^{9})$ . The second line contains a single integer $n$ $(1<=n<=2·10^{9})$ .
输出格式
Output a single integer representing $f_{n}$ modulo $1000000007$ $(10^{9}+7)$ .
输入输出样例
输入 #1
2 3 3
输出 #1
1
输入 #2
0 -1 2
输出 #2
1000000006
说明/提示
In the first sample, $f_{2}=f_{1}+f_{3}$ , $3=2+f_{3}$ , $f_{3}=1$ .
In the second sample, $f_{2}=-1$ ; $-1$ modulo $(10^{9}+7)$ equals $(10^{9}+6)$ .
In the second sample, $f_{2}=-1$ ; $-1$ modulo $(10^{9}+7)$ equals $(10^{9}+6)$ .