# Enter your code here. Read input from STDIN. Print output to STDOUT import sys lst = map(int, raw_input().split()) k = int(0.5*lst[0] + 0.5*lst[1]) print int(pow(k,lst[2], (pow(10,9)+7))) ''' ans = long(0) t = long(lst[2]) long for i in range(1,t+1): ans = (ans + (0.5*lst[0]*i + 0.5*lst[1]*i)) % 1000000007#(pow(10,9)+7) #print ans print long(ans) '''