题库练习 Jzzhu and Sequences
← 上一题 下一题 →

A9482 | Jzzhu and Sequences

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Jzzhu has invented a kind of sequences, they meet the following property:

![](/uploads/acgo/image/c4bcdd62f23df016_fe89358ea6f4.jpeg)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
C++ 编辑器
输入
输出