Codeforces Round 257 (Div. 2)
翻译中…
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)$.
翻译中…
Input
翻译中…
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
翻译中…
Output a single integer representing $*f*_{*n*}$ modulo $1000000007$ $(10^{9} + 7)$.
翻译中…
Note
翻译中…
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)$.
翻译中…
样例
Input #1
2 3
3
Output #1
1
InputCopy
OutputCopy
Input #2
0 -1
2
Output #2
1000000006
InputCopy
OutputCopy
题目信息
标签
模拟
数学
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。