# Enter your code here. Read input from STDIN. Print output to STDOUT def power(x,y): if y == 0: return 1 temp = power(x, y/2) if y%2 == 0: return temp*temp%1000000007 else: return (x*temp*temp)%1000000007 a,b,t=map(int,raw_input().split(' ')) virus=1 virus=power(int((a+b)*0.5),t) print virus