# Enter your code here. Read input from STDIN. Print output to STDOUT a, b, t = map(int, input().strip().split()) k = 0.5 * (a + b) x = pow(int(k), t, 1000000007) print(int(round(x, 0)))