import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { BigInteger ans = new BigInteger("1"); public static void main(String[] args) { Scanner scan = new Scanner(System.in); String firstRow = scan.nextLine(); String[] firstRowSplit = firstRow.split("\\s"); int growthOfA, growthOfB; BigInteger time; growthOfA = Integer.parseInt(firstRowSplit[0]); growthOfB = Integer.parseInt(firstRowSplit[1]); time = new BigInteger(firstRowSplit[2]); BigDecimal ans = new BigDecimal(String.valueOf((0.5 * growthOfA) + (0.5 * growthOfB))); BigInteger temp = ans.toBigInteger().modPow(time, new BigInteger("1000000007")); System.out.println(temp); } }