import java.io.*; import java.util.*; import java.math.BigInteger; public class Solution { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); BigInteger t = new BigInteger(in.next()); int temp = (a+b)/2; BigInteger mod = new BigInteger("1000000007"); BigInteger v = new BigInteger(Integer.toString(temp)); System.out.println(v.modPow(t, mod)); } }