a,b,t = [int(i) for i in input().strip().split(' ')] def modular_power(base, exp, mod): res = 1 base = base%mod while exp > 0: if exp%2 == 1: res = (res * base)%mod exp -= 1 base = (base * base)%mod exp = exp//2 #print(exp, base, res) return(res) mod = pow(10,9) + 7 #mod = 100 base = int(0.5*(a+b)) #res = modular_power(base, t, mod) res = pow(base,t,int(mod)) print(int(res)) #print(int(pow(0.5*(a+b),t)%mod))