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); String line = in.nextLine(); String [] parts = line.split(" "); String modS = "1000000007"; BigInteger modB = new BigInteger(modS); float a = Float.parseFloat(parts[0]); float b = Float.parseFloat(parts[1]); BigInteger t = new BigInteger(parts[2]); //double module = Math.pow(10, 9)+7; BigInteger divVal = new BigInteger("10000"); int multiplier =(int) (0.5 * (a + b)*10000); String multS = Integer.toString(multiplier); BigInteger multB = new BigInteger(multS); multB = multB.divide(divVal); BigInteger res = multB.modPow(t, modB);// power(multB.intValue(), t.intValue());//multB.pow(t.intValue()); //res = res.mod(modB); System.out.println(res.intValue()); } }