# Enter your code here. Read input from STDIN. Print output to STDOUT a, b, t = map(int, raw_input().strip().split()) x = (a + b)//2 m = 10**9 + 7 x_m = x % m p = 1 while t > 0: if t % 2: p *= x_m p = p % m t /= 2 x_m = (x_m * x_m) % m print p