import sys a, b, t = [int(x) for x in sys.stdin.read().strip().split(' ')] v = pow(int((a+b) * 0.5), t, pow(10, 9) + 7) print(v)