import sys for line in sys.stdin: a, b, t = line.split(' ') a, b, t = int(a), int(b), int(t) #for step in range(t): # count = a * count + b * count fudge = 1 if (a + b) % 2 != 0 else 0 count = pow((a + b)//2 + fudge, t, (10**9 + 7)) print(count)