# Enter your code here. Read input from STDIN. Print output to STDOUT a=raw_input().split(' ') c=int(0.5*(int(a[0])+int(a[1]))) print long(pow(c,long(a[2]),1000000007))