import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); int ab = (int) (0.5 * (a+b)); BigInteger t = new BigInteger(in.next()); BigInteger count = new BigInteger(String.valueOf(ab)); BigInteger modVal = new BigInteger("1000000007"); System.out.println(count.modPow(t, modVal)); } }