# Enter your code here. Read input from STDIN. Print output to STDOUT # Enter your code here. Read input from STDIN. Print output to STDOUT a,b,t=map(int,raw_input().strip().split(' ')) #print int((.5*a*t+.5*b*t)%(10**9+7)) temp=(a+b)/2 prev=1 modu=10**9+7 print int(pow(temp,t,modu))