/* Programming Competition - Template (Horatiu Lazu) */ import java.io.*; import java.util.*; import java.lang.*; import java.awt.*; import java.awt.geom.*; import java.math.*; import java.text.*; class ProblemD{ BufferedReader in; StringTokenizer st; int MOD = (int)Math.pow(10, 9) + 7; public static void main (String [] args){ new ProblemD(); } int fast_exp(long base, long exp) { long res=1; while(exp>0) { if(exp%2==1) res=(res*base)%MOD; base=(base*base)%MOD; exp/=2; } return (int)res%MOD; } public ProblemD(){ try{ in = new BufferedReader(new InputStreamReader(System.in)); int a = nextInt(); int b = nextInt(); long t = nextLong(); int ans = (fast_exp((a+b)/2, t) % ((int)Math.pow(10, 9)+7)); //int ans = ((int)(0.5 * 1 * fast_exp(a, t) + (int)(0.5 * 1 * (int)fast_exp(b, t))) % ((int)((int)Math.pow(10, 9) + 7))); System.out.println(ans); //System.out.println((long)((0.5 * 1 * Math.pow(a, t) + 0.5 * 1 * Math.pow(b, t)) % (Math.pow(10, 9) + 7))); } catch(IOException e){ System.out.println("IO: General"); } } String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine().trim()); return st.nextToken(); } long nextLong() throws IOException { return Long.parseLong(next()); } int nextInt() throws IOException { return Integer.parseInt(next()); } double nextDouble() throws IOException { return Double.parseDouble(next()); } String nextLine() throws IOException { return in.readLine().trim(); } }