import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); BigInteger t = in.nextBigInteger(); //int t = in.nextInt(); BigInteger modulo = new BigInteger("1000000007"); Integer nu = (int)(0.5*(a+b)); BigInteger plus = new BigInteger("1"); BigInteger num = new BigInteger(nu.toString()); //System.out.println("num: " + num.toString() + " t: " + t.toString()); while (!t.equals(new BigInteger("1"))) { if (!t.mod(new BigInteger("2")).equals(new BigInteger("0"))) { plus = plus.multiply(num); } num = num.multiply(num); num = num.mod(modulo); t = t.divide(new BigInteger("2")); //System.out.println("num: " + num.toString() + " t: " + t.toString()); } num = num.multiply(plus); num = num.mod(modulo); //System.out.println(plus); System.out.println(num); } }