#include #include #include #include #include using namespace std; unsigned long long getCellNumber(int a, int b, unsigned long long t) { unsigned long long cellNumber = 1; const int MOD = 1000000007; unsigned long long growthPerMillisecond = (a + b) / 2; growthPerMillisecond = growthPerMillisecond % MOD; while (t > 0) { if (t & 1) { cellNumber = (growthPerMillisecond * cellNumber) % MOD; } t = t >> 1; growthPerMillisecond = (growthPerMillisecond * growthPerMillisecond) % MOD; } return cellNumber; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int a, b; unsigned long long t; cin >> a >> b >> t; cout << getCellNumber(a, b, t) << endl; return 0; }