#include <iostream>
#include <fstream>
using namespace std;
const int MOD = 1e9 + 7;
int main()
{
long long x, y, n, tmp;
while (cin >> x >> y >> n) {
n = n % 6;
if (n == 1) tmp = x;
if (n == 2) tmp = y;
if (n == 3) tmp = y - x;
if (n == 4) tmp = -x;
if (n == 5) tmp = -y;
if (n == 0) tmp = x - y;
cout << ((tmp % MOD) + MOD) % MOD << endl;
}
return 0;
}
Codeforces Round #257 (Div. 2)1B Jzzhu and Sequences
最新推荐文章于 2021-04-25 09:43:00 发布