def powfast(x,n): if(n==0): return 1 elif(n==1): return x%1000000007 elif(n%2==0): temp = (powfast(x,n/2)%1000000007) return (temp*temp)%1000000007 else: temp = (powfast(x,n/2)%1000000007) return ((x%1000000007)*temp*temp)%1000000007 a,b,t = [int(x) for x in raw_input().strip().split()] print powfast((a+b)/2,t)