# Enter your code here. Read input from STDIN. Print output to STDOUT s=map(int, raw_input().split()) a=s[0] b=s[1] t=s[2] v=1 f=(a+b)/2 s="{0:b}".format(t) for i in s[::-1]: if i == '1': v*=f v=v%1000000007 f=(f*f)%1000000007 print(v)