import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scanner = new Scanner(System.in); int a, b; long t; a = scanner.nextInt(); b = scanner.nextInt(); t = scanner.nextLong(); scanner.close(); int factor = (a + b) / 2; System.out.println(powerFunction(factor, t)); } public static long powerFunction (int base, long power) { if (power == 1) return (long)base; long res = powerFunction(base, power / 2); if (power % 2 == 1 ) { res *= res; res %= 1000000007L; res *= (long)base; res %= 1000000007L; return res; } else { res *= res; res %= 1000000007L; return res; } } }