#include #include #include #include #include using namespace std; typedef unsigned long long ull; template T modpow(T base, T exp, T modulus) { base %= modulus; T result = 1; while (exp > 0) { if (exp & 1) result = (result * base) % modulus; base = (base * base) % modulus; exp >>= 1; } return result; } /* Function to calculate x raised to the power y in O(logn)*/ uint64_t power(uint64_t x, uint64_t y) { uint64_t temp; if( y == 0) return 1; temp = power(x, y/2) ; if (y%2 == 0) return temp*temp ; else return x*temp*temp ; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int a, b; cin >> a >> b; uint64_t t; cin >> t; //ull result = power(((a+b)/2), t); cout << modpow(((a+b)/2), t, 1000000007) << "\n"; return 0; }