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.
turn = "a"
S = {}

S["a"] = list(input())
S["b"] = list(input())
S["c"] = list(input())

while True:
    S[turn].pop(0)
    if len(S[turn]) == 0:
        print(turn.upper())
        break
a = int(input())
b = int(input())
c = int(input())

print((a  + b) * c // 2)