import java.util.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); long t = scan.nextLong(); long size = 1; for(long i =0; i < t; ++i){ size = (a*size/2) + (b*size/2) % 1000000007L; } System.out.println(size); } }