import sys a, b, t = [int(x) for x in input().split()] if t == 0: print(1) elif t == 1: print(int((a + b) / 2)) else: print(int(pow((a + b) // 2, t, 10**9 + 7)))