import java.io.*; import java.util.*; import java.math.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); int i=(a+b)/2; BigInteger t = sc.nextBigInteger(); BigInteger base = BigInteger.valueOf(i); long j=1000000007; BigInteger mod = BigInteger.valueOf(j); BigInteger res = base.modPow(t, mod); System.out.println(res); } }