# Enter your code here. Read input from STDIN. Print output to STDOUT A, B, t = [int(i) for i in raw_input().split()] e = int(t) m = int(1000000007) base = int(0.5*(A+B)) print pow(base, e, m)