from sys import stdin a,b,t = [int(n.strip()) for n in stdin.read().split()] print(int(pow(int(0.5*(a+b)), t, 10**9 + 7)))