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 in = new Scanner(System.in); long a=in.nextLong(), b=in.nextLong(); long t=in.nextLong(), base=(a+b)/2; long ans=power(base,t); ans%=((long)1e9+7); System.out.print(ans); } static long power(long base, long exp) { if(exp==0) return 1; else if(exp==1) return base; long root=power(base,exp/2); root=root%((long)1e9+7); if(exp%2==0) return root*root; else return ((root*root)%(((long)1e9+7)))*base; } }