import java.io.*; import java.util.*; import java.math.*; public class Solution { private static BigInteger two = new BigInteger("2"); private static BigInteger bigPrime = new BigInteger("1000000007"); private static BigInteger pow2(BigInteger base, BigInteger power) { if (power.equals(BigInteger.ZERO)) { return BigInteger.ONE; } else { if (power.mod(two).equals(BigInteger.ZERO)) { BigInteger half = pow2(base, power.divide(two)); return half.multiply(half).mod(bigPrime); } else { return base.multiply(pow2(base, power.subtract(BigInteger.ONE))); } } } public static void main(String[] args) { long millis = System.currentTimeMillis(); /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scan = new Scanner(System.in); BigInteger a = scan.nextBigInteger(); BigInteger b = scan.nextBigInteger(); BigInteger t = scan.nextBigInteger(); BigInteger factor = a.add(b).divide(two); System.out.println(pow2(factor, t).mod(bigPrime)); } }