import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) throws IOException { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = in.readLine(); String[] parts = line.split(" "); int a = Integer.parseInt(parts[0]); int b = Integer.parseInt(parts[1]); BigInteger base = new BigInteger( String.valueOf((a + b)/2) ); BigInteger t = new BigInteger(parts[2]); BigInteger m = new BigInteger( "1000000007" ); BigInteger res = base.modPow( t, m ); System.out.println(res); } }