a,b,t = [int(x) for x in input().split()] q1 = int(0.5*(a+b)) print(pow(q1,t,1000000007))