inputlist = [int(height_temp) for height_temp in input().strip().split(' ')] factor = int(0.5*inputlist[0] + 0.5*inputlist[1]) print(int((pow(factor,inputlist[2],1000000007))))