# Enter your code here. Read input from STDIN. Print output to STDOUT def power(x,y): d=10**9+7 if y==0: return 1 temp=power(x,y/2) if y%2==0: return ((temp%d)*(temp)%d)%d else: return ((((x%d)*(temp)%d)%d)*(temp)%d)%d a,b,t=map(int,raw_input().split()) c=(a+b)/2 d=power(c,t) print d