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 C (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <stdio.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
//using namespace std;

int main()
{
    char a[100], b[100], c[100];
    int i = 0, j = 0, k = 0;
    int inda = 0, indb = 0, indc = 0;

    gets(a);
    gets(b);
    gets(c);

    int lena = strlen(a), lenb = strlen(b), lenc = strlen(c);

    int current = 1, flag = TRUE;

    while (flag) {
        while (current == 1) {
            if (a[i] == 'b') {
                current = 2;
            }
            else if (a[i] == 'c') {
                current = 3;
            }
            ++i;
            if (i == lena) {
                ++inda;
                flag = FALSE;
                break;
            }
        }
        //if (inda) break;
        while (current == 2) {
            //printf("\nHi there");           ///debugger#1

            if (b[j] == 'a') {
                current = 1;
            }
            else if (b[j] == 'c') {
                current = 3;
            }
            ++j;
            if (j == lenb) {
                ++indb;
                flag = FALSE;
                break;
            }
        }
       // if (indb) break;
        while (current == 3) {
            if (c[k] == 'b') {
                current = 2;
            }
            else if (c[k] == 'a') {
                current = 1;
            }
            ++k;
            if (k == lenc) {
                ++indc;
                flag = FALSE;
                break;
            }
        }
       // if (indc) break;
    }
    //printf("%d %d %d\n %d %d %d", inda, indb, indc, i, j, k);
    if (inda) printf("A");
    else if (indb) printf("B");
    else if (indc) printf("C");


    return 0;
}