Problem:
Score : 100 points

Problem Statement

You are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.

An example of a trapezoid

Find the area of this trapezoid.

Constraints

1≦a≦100

1≦b≦100

1≦h≦100

All input values are integers.

h is even.

Input

The input is given from Standard Input in the following format:

a
b
h

Output

Print the area of the given trapezoid. It is guaranteed that the area is an integer.

Sample Input 1

3
4
2

Sample Output 1

7

When the lengths of the upper base, lower base, and height are 3, 4, and 2, respectively, the area of the trapezoid is (3+4)×2/2 = 7.

Sample Input 2

4
4
4

Sample Output 2

16

In this case, a parallelogram is given, which is also a trapezoid.

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Runtime Error)

import java.io.*;

public class Main {
	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		try {
			String numbers = reader.readLine();
			long resultSum = 0;
			int len = numbers.length();
			int plusSpaces = len -1;
			int[] plusArray = new int[plusSpaces];
			for (int i = 0; i <  (int) Math.pow(2, plusSpaces); i++) {
				String plus = String.format("%"+plusSpaces+"s", Integer.toBinaryString(i)).replace(" ", "0");
				String numbersWithPlus = "";
				for (int j = 0; j < plus.length(); j++) {
					numbersWithPlus += numbers.charAt(j);
					char p = plus.charAt(j);
					if(p == '1') {
						numbersWithPlus += "+";
					}
				}
				numbersWithPlus += numbers.charAt(len-1);
				long sum = 0;
				if(numbersWithPlus.contains("+")) {
					String[] fomula = numbersWithPlus.split("\\+");	//特殊文字なので\\が必要
					for(String value : fomula) {
						sum += Long.parseLong(value);
					}
				} else {
					sum = Long.parseLong(numbersWithPlus);
				}
				resultSum += sum;
			}
			System.out.println(resultSum);
			
		} catch(IOException e) {
			System.out.println(e);
		}
		
	}

}