import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static final BigInteger MOD_VALUE = BigInteger.valueOf(1_000_000_007); public static int getAnswer(int a, int b, BigInteger t) { int x = (a + b) / 2; BigInteger bigX = BigInteger.valueOf(x); BigInteger answer = bigX.modPow(t, MOD_VALUE); return answer.intValue(); } public static void main(String[] args) { try (Scanner in = new Scanner(System.in);) { int a = in.nextInt(); int b = in.nextInt(); BigInteger t = in.nextBigInteger(); System.out.println(getAnswer(a, b, t)); } } }