# Enter your code here. Read input from STDIN. Print output to STDOUT a,b,t=raw_input().strip().split(' ') a=int(a) b=int(b) t=int(t) print pow((int((a+b)*.5)),t,1000000007) #cells=(.5*(a+b)%1000000007)^t #cells=1 #seconds=1 #while seconds<=t: # cells=((.5*(a%1000000007)*(cells%1000000007)%1000000007)+(.5*(b%1000000007)*(cells%1000000007)%1000000007))%1000000007 # seconds+=1 print int(cells)