# Enter your code here. Read input from STDIN. Print output to STDOUT p = 0.5 c1 = 1000000007.0 io = raw_input().strip() abt = map(int, io.split(' ')) def ans(a, b, t): cells = 1 for t_ in range(1,t+1): c = p*a*t_ + p*b*t_ cells = c % c1 print int(cells) ans(abt[0], abt[1], abt[2])