import sys,math; def pow_mod(x, y, z): "Calculate (x ** y) % z efficiently." number = 1 while y: if y & 1: number = number * x % z y >>= 1 x = x * x % z return number arr = list() arr.append(map(int, raw_input().split())) a = arr[0][0] b = arr[0][1] t = arr[0][2] p = int(0.5*(a+b)) #index = int(math.log(10**9+7,p)) #re = pow(p,index+1) %10**9+7 print(pow(p,t,10**9+7)) #print (int(pow_mod(p,t,10**9+7)))