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) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); long a=in.nextLong(); long b=in.nextLong(); a=(a+b)/2; a=a%1000000007; long t=in.nextLong(); System.out.println(pow(a,t)); } public static long pow(long a,long t){ if(t==0){ return 1; } if(t==1){ return a%1000000007; } if(t%2==1){ return (a*(pow(a,t-1)))%1000000007; } long half = pow(a,t/2)%1000000007; return (half*half)%1000000007; } }