CF450B.Jzzhu and Sequences
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Jzzhu has invented a kind of sequences, they meet the following property:

You are given x and y, please calculate f__n modulo 1000000007 (109 + 7).
Jzzhu 发明了一种数列,该数列满足如下性质:

给定 x 和 y,请计算 fn 对 1000000007(即 109+7)取模的结果。
输入格式
The first line contains two integers x and y (|x|, |y| ≤ 109). The second line contains a single integer n (1 ≤ n ≤ 2·109).
第一行包含两个整数 x 和 y(∣x∣,∣y∣≤109)。第二行包含一个整数 n(1≤n≤2⋅109)。
输出格式
Output a single integer representing f__n modulo 1000000007 (109 + 7).
输出一个整数,表示 fn 对 1000000007(即 109+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 (109 + 7) equals (109 + 6).
在第一个样例中,f2=f1+f3,即 3=2+f3,因此 f3=1。
在第二个样例中,f2=−1;−1 对 109+7 取模的结果为 109+6。
输入解题思路,AI测评打分。不知道怎么写?