# Enter your code here. Read input from STDIN. Print output to STDOUT 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 a,b,t =(map(int,raw_input().strip().split(' '))) modulo = int(10**9 +7) growthRate = int(0.5 *(a+b)) #print int( pow_mod(growthRate, t,modulo)) print (int(pow(growthRate,t,modulo))) #print int((growthRate)**t%modulo)