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