import sys import math inputs = [int(tmp) for tmp in input().strip().split(' ')] a = inputs[0] b = inputs[1] t = inputs[2] mod = 1000000007 def mod_pow(x, y, mod): ans = 1 while y: if y & 1: ans = ans * x % mod y >>= 1 x = x * x % mod return ans print(mod_pow(int((a + b) / 2), t, mod))