import java.io.*; import java.util.*; import java.math.BigInteger; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int val = sc.nextInt(); val += sc.nextInt(); val >>= 1; BigInteger bi = BigInteger.valueOf(val); bi = bi.modPow(sc.nextBigInteger(), new BigInteger("1000000007")); System.out.println(bi.toString()); } }