#include #include #include #include #include using namespace std; const unsigned long long int peak = (int) 1e9+7; static unsigned long long int base; unsigned long long int res(unsigned long long int t){ //cout << "res:" << t << "\n"; if(t==1){ return base; } if(t==0){ return 1; } unsigned long long int half = t/2; unsigned long long int ele = res(half); if(t%2==0){ return (unsigned long long int) (ele*ele)%peak; } else{ return (unsigned long long int) ((ele*ele)%peak)*base%peak; } } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ unsigned long long int a,b; unsigned long long int t; cin>>a>>b>>t; base = (a+b)/2; // cout << peak <<"\n"; // cout << base <<"\n"; cout << res(t) <<"\n"; return 0; }