#include #include #include #include #include using namespace std; /* Iterative Function to calculate (x^n)%p in O(logy) */ inline long power(long x, long y, long p) { long res = 1; // Initialize result x = x % p; // Update x if it is more than or // equal to p while (y > 0) { if (y & 1) res = (res*x) % p; y = y>>1; // y = y/2 x = (x*x) % p; } return res; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int a; int b; long t; scanf("%d %d %ld", &a, &b, &t); long mod = 1; for (int i =0 ; i < 9; i++) { mod *= 10; } mod += 7; long x = (a+b) >> 1; long n = power(x, t, mod); cout<