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 scan = new Scanner(System.in); String[] elements = scan.nextLine().split(" "); scan.close(); int a, b, c; long t, m; a = Integer.parseInt(elements[0]); b = Integer.parseInt(elements[1]); c = (a+b)/2; t = Long.parseLong(elements[2]); m = 1000000007; System.out.print(power(c, t, m)); } public static long power(int base, long exponent, long mod){ if(exponent == 0){ return 1; } long recursivePower = power(base, exponent/2, mod)%mod; if(exponent%2==0){ return (recursivePower*recursivePower)%mod; }else{ return (((base*recursivePower)%mod)*recursivePower)%mod; } } }