mod = 10 ** 9 + 7 def power(n, p): n = n % mod if p == 0: return 1 elif p == 1: return n elif p % 2 == 0: tmp = (power(n, p // 2)) % mod return (tmp * tmp) % mod else: # p % 2 == 1 tmp = (power(n, p // 2)) % mod return (tmp * tmp * n) % mod def num_copies_after_t(a, b, t): # want to calculate 1 * 0.5 * (a ** t + b ** t) return (power((a + b) // 2, t) % mod ) a, b, t = map(int, input().split(' ')) print(num_copies_after_t(a, b, t))