info = input().split() a = int(info[0]) b = int(info[1]) t = int(info[2]) m = 10**9 + 7 exp_r = (a+b)/2 t_seq = str(bin(t))[2:][::-1] r0 = int(exp_r % m) res = 1 for ch in t_seq: if ch == '1': res = int((res * r0) % m) r0 = int((r0 * r0) % m) print(int(res))