from math import pow, log # 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(" ")) mean_a_b = int((float(a) + float(b))/2) c = int(pow(10, 9) + 7) print int(pow_mod(mean_a_b, t, c))