# Enter your code here. Read input from STDIN. Print output to STDOUT a, b, t = map(int, raw_input().split(' ')) # cells = (0.5 * (a + b)) ** t cells = pow(int(0.5 * (a + b)), t, 10 ** 9 + 7) print int(cells)