#include #include #include #include #include using namespace std; /* Iterative Function to calculate (x^y) in O(logy) */ long long int power( long long x, long long y, long long p) { long long res = 1; // Initialize result x = x % p; // Update x if it is more than or // equal to p while (y > 0) { // If y is odd, multiply x with result if (y & 1) res = (res*x) % p; // y must be even now y = y>>1; // y = y/2 x = (x*x) % p; } return res; } int main() { long long a ,b ; long long total,t; cin >> a >> b >> t; total = power((.5*(a+b)),t,(pow(10,9)+7)); // total = power((.5*(a+b)),t) % (unsigned long int)(pow(10,9)+7); cout << total; /* Enter your code here. Read input from STDIN. Print output to STDOUT */ return 0; }