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) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); long t = in.nextLong(); BigInteger t2 = BigInteger.valueOf(t); //BigInteger a2 = BigInteger.valueOf(a); //BigInteger b2 = BigInteger.valueOf(b); int ff = (a+b)/2; BigDecimal b1 = BigDecimal.valueOf(ff); double mod = Math.pow(10,9) + 7; BigDecimal b2 = BigDecimal.valueOf(mod); BigInteger b22 = b2.toBigInteger(); BigInteger b11 = b1.toBigInteger(); BigInteger b3; b3 = b11.modPow(t2,b22); System.out.println(b3); } }