# Enter your code here. Read input from STDIN. Print output to STDOUT s = map(int,raw_input().split()) a = s[0] b = s[1] p = 1 r = (a+b)/2 cells = p * pow(r, s[2], 1000000007) print cells%1000000007