def readints(): return list(map(int, input().strip().split())) a, b, t = readints() growth = (a + b) // 2 print(pow(growth, t, 1000000007))