import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static final long MOD = 1000000007; public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); long t = in.nextLong(); long n = (a + b) / 2; System.out.println(power(n, t)); } static long power(long base, long exponent) { if(exponent == 1) return base; if(exponent % 2 == 0) return power(base * base % MOD, exponent / 2); else return (power(base, exponent - 1) * base) % MOD; } }