import java.io.*; import java.util.*; import java.math.BigInteger; public class Solution { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int a = scn.nextInt(); int b = scn.nextInt(); BigInteger t = scn.nextBigInteger(); int x = Math.floorDiv(a+b, 2); BigInteger y = new BigInteger(String.valueOf(x)); int mod = (int) Math.pow(10, 9) + 7; BigInteger res = y.modPow(t, new BigInteger(String.valueOf(mod))); System.out.println(res.intValue()); scn.close(); } }