import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long t = 1; static int a = 2; static int b = 4; static long noOfVirus = 1; public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = readLine(br); String[] lineParts = line.split(" "); a = Integer.parseInt(lineParts[0]); b = Integer.parseInt(lineParts[1]); t = Long.parseLong(lineParts[2]); for(long i = 1; i <= t; i++) noOfVirus = ((a * noOfVirus + b * noOfVirus) / 2) % (1000000007); System.out.println(noOfVirus); } private static String readLine(BufferedReader br) { String line = ""; try{ line = br.readLine(); } catch(Exception e){} return line.trim(); } }