# Enter your code here. Read input from STDIN. Print output to STDOUT a, b, T = map(int, raw_input().strip().split(' ')) size = 1 for t in range(T): size = 0.5*a*size+0.5*b*size print int(size % (10e9 + 7))