import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); long a = in.nextLong(); long b = in.nextLong(); long t = in.nextLong(); long base = (long)(a * 0.5 + b * 0.5); long exponent = t; long modulus = 1000000007; long result = 1; base = base % modulus; while (exponent > 0) { if (exponent % 2 == 1) { result = result * base % modulus; } exponent = exponent >> 1; base = base * base % modulus; } System.out.println(result); } }