import java.io.*; import java.util.*; import java.math.BigInteger; public class Solution { public static void main(String args[]){ int a, b; BigInteger t; Scanner s = new Scanner(System.in); a = s.nextInt(); b = s.nextInt(); int val = (int) (.5 * (a + b)); BigInteger base = new BigInteger(Integer.toString(val)); BigInteger mod = new BigInteger("1000000007"); t = s.nextBigInteger(); BigInteger res = base.modPow(t, mod); System.out.println(res.toString()); }//end main }