import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int a, b; BigInteger t = null; BigInteger r = null; String m = "1000000007"; a = scanner.nextInt(); b = scanner.nextInt(); t = scanner.nextBigInteger(); r = BigInteger.valueOf((a + b)/2); r = r.modPow(t, new BigInteger(m)); System.out.println(r); scanner.close(); } }