a,b,t = map(int,input().split()) x = int((a+b)/2) z = 10**9 + 7 print (pow(x,t,z))