a, b, t = list(map(int, input().split(" "))) tt = t binary = "{0:b}".format(t) v = 1 vv = (int(0.5*(a+b))) % (10**9 + 7) while t > 0: if t % 2 == 1: v *= vv v = v % (10**9 + 7) t = t//2 vv = vv**2 vv = vv % (10**9 + 7) print(int(v))