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) { //Read in input Scanner scanner = new Scanner(System.in); //BigDecimal and BigInteger are unbounded numbers (limited only by RAM) BigDecimal a = scanner.nextBigDecimal(); BigDecimal b = scanner.nextBigDecimal(); BigDecimal t = scanner.nextBigDecimal(); BigDecimal p_a = BigDecimal.valueOf(0.5); BigDecimal p_b = BigDecimal.valueOf(0.5); //Calculate final growth and convert to integer //Breaking down this formula: (p_a * a * t + p_b * b * t) % (Math.pow(10, 9) + 7) //p_a * a * t BigDecimal temp = p_a.multiply(a); temp = temp.multiply(t); //p_b * b * t BigDecimal temp2 = p_b.multiply(b); temp2 = temp2.multiply(t); //Compute first and second term //(p_a * a * t + p_b * b * t) BigDecimal firstTerm = temp.add(temp2); //Math.pow(10, 9) + 7 BigDecimal secondTerm = BigDecimal.valueOf(Math.pow(10,9)+7); //Result is given by (First Term) % (Second Term) BigDecimal result = firstTerm.remainder(secondTerm); //Convert to BigInteger BigInteger finalGrowth = result.toBigInteger(); //Print result System.out.println(finalGrowth); }//end main }//end Solution