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) { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); long t1 = scan.nextLong(); double t = (double)t1; double factor,cells; factor = ((((0.5)*a)+((0.5)*b))%(1000000007)); cells = Math.pow(factor,t); cells = cells%1000000007; System.out.println((long)cells); } }