# Enter your code here. Read input from STDIN. Print output to STDOUT a,b,n = map(int,raw_input().split()) i = int(0.5*(a+b)) print pow(i,n,1000000007)