#include #include #include #include #include #include using namespace std; vector bin(60); int index = 0; void binary(long number) { int remainder; if(number <= 1) { bin[index] = number; index --; return; } remainder = number%2; index++; binary(number >> 1); bin[index] = remainder; index --; } int main() { uintmax_t a; uintmax_t b; long long t; long long output = 1; uintmax_t answer; double sec; uintmax_t sec1; int cnt = 0; bool oneEnc = false; cin >> a >> b >> t; sec = (a*1/2.0 + b*1/2.0); if(fmod(sec,1) >= 5){ sec = ceil(sec); }else{ sec = floor(sec); } sec1 = int(sec); answer = sec1; if(t == 0){ cout << 1; exit(0); } binary(t); for(int i = 59; i >= 0; i--){ if(oneEnc){ if(bin[i] == 0){ answer = (answer*answer)%1000000007; }else if(bin[i] == 1){ answer = (((answer*answer)%1000000007) * sec1)%1000000007; } }else if(!oneEnc){ if(bin[i] == 1){ oneEnc = true; } } } cout << answer ; return 0; }