def modpower(x, y, m): out = int(1) x = int(x % m) while (y > 0): if ((y % 2) == 1): out = int((x*out) % m) y -= 1 y = int(y >> 1) x = int((x*x) % m) return out a, b, t = list(map(int, input().strip().split(' '))) e_ab = (a+b)//2 print(int(modpower(e_ab, t, int(1e9 + 7))))