import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long a = Integer.parseInt(sc.next()); long b = Integer.parseInt(sc.next()); long c = (a+b)/2; System.out.println(power(c, new BigInteger(sc.next()), 0)); } static long power(long x, BigInteger y, int bit) { if( bit == y.bitLength()) return 1; else if (!y.testBit(bit)){ long z = power(x, y, bit+1); return (z*z)%1000000007; } else { long z = power(x, y, bit+1); return (((x*z)%1000000007)*z)%1000000007; } } }