a,b,t = input().strip().split(' ') a,b,t = [int(a),int(b),int(t)] #print(a,b,t) #print(2**3) total=0.5*a*(2**(t-1))+0.5*b*(2**(t-1)); print(int(total%(10**9+7)))