import java.io.*; import java.util.*; import java.math.BigDecimal; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); long time = in.nextLong(); long aSum = Math.multiplyExact((long)a, time); long bSum = Math.multiplyExact((long)b, time); long totalSum = aSum + bSum; BigDecimal val = new BigDecimal(totalSum); val = val.multiply(BigDecimal.valueOf(0.5)); BigDecimal remainder = val.remainder(BigDecimal.valueOf(Math.pow(10, 9)+7)); if(remainder.compareTo(BigDecimal.valueOf(0)) < 0){ System.out.println(val.toBigInteger().toString()); }else{ System.out.println(remainder.toBigInteger().toString()); } } }