import java.io.*; import java.math.*; import java.util.*; public class Solution { public static void main(String[] args) { final Scanner in = new Scanner(System.in); final int a = in.nextInt(); final int b = in.nextInt(); final long t = in.nextLong(); final BigInteger bigT = BigInteger.valueOf(t); final BigInteger exp = BigInteger.TEN.pow(9).add(BigInteger.valueOf(7)); final BigInteger e = BigInteger.valueOf( (long) ((b * 0.5) + (a * 0.5))).modPow(bigT,exp); System.out.println(e); } }