import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); double a = in.nextDouble(); double b = in.nextDouble(); BigInteger t = in.nextBigInteger(); Long summations = (long)((a+b)/2); BigInteger expected = BigInteger.valueOf(summations); BigInteger constModi = BigInteger.valueOf(1000000007); BigInteger res = expected.modPow(t , constModi); System.out.println(res.toString()); } }