a, b, t = input().split() a, b, t = int(a), int(b), int(t) pop = 1 for i in range(t): pop = (0.5 * a * pop) + (0.5 * b * pop) print(int(pop) % (10**9 + 7))