#!/bin/python import sys def modular_pow(base, exponent, modulus): if modulus == 1: return 0 result = 1 base = base % modulus while exponent > 0: if exponent % 2 == 1: result = (result * base) % modulus exponent = exponent >> 1 base = (base * base) % modulus return result a, b, t = map(int,raw_input().strip().split(' ')) factor = int((0.5 * a) + (0.5 * b)) growth = modular_pow(factor, t, pow(10, 9) + 7) print growth