import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { /* 1 .5a .5b) 2 .5a.5a .5b.5b 3 .5a.5a.5a */ public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); BigInteger t = in.nextBigInteger(); BigInteger mod = (new BigInteger("10")).pow(9).add(new BigInteger("7")); BigInteger i1 = (new BigDecimal(.5*a + .5*b)).toBigInteger(); BigInteger tA = i1.modPow(t,mod); //double tA = Math.pow((double)a * .5,(double)t); //double tB = Math.pow((double)b * .5,(double)t); System.out.println( tA ); } }