a,b,t = [int(s) for s in raw_input().split(" ")] cI = 0.5*a + 0.5*b print((int(cI)**t)%(10**9+7))