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 = new BigInteger(in.next()); Integer val = (int) (0.5*a+0.5*b); BigInteger c = new BigInteger(val.toString()); BigInteger res = c.modPow(t,new BigInteger("1000000007")); System.out.println(res); } }