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(); BigInteger t = new BigInteger(in.next()); long bs = (long) (a+b)/2; BigInteger base = BigInteger.valueOf(bs); BigInteger out = myPower(base,t); System.out.println(out); } static BigInteger myPower(BigInteger base,BigInteger t) { BigInteger temp; BigInteger m = new BigInteger("1000000007"); if( t.compareTo(new BigInteger("0")) == 0) { return (new BigInteger("1")); } temp = myPower(base, t.divide(new BigInteger("2"))); if (t.remainder(new BigInteger("2")).compareTo(new BigInteger("0")) == 0) { return (temp.multiply(temp).remainder(m)); } else { return (base.multiply(temp).multiply(temp).remainder(m)); } } }