def main(x, y): res = 1 x %= 1000000007 while y > 0: if y & 1: res = (res * x) % 1000000007 y >>= 1 x = (x * x) % 1000000007 return res l = input().split() t = int((int(l[0]) + int(l[1])) / 2) print(main(t, int(l[2])))