Truck Parking Fees

Time limit1sMemory limit128 MB

Problem

A driver owns three trucks. The parking lot charges a discounted per-truck fee depending on how many of the trucks are parked at the same time.

If exactly one truck is parked, the fee is A won per minute for that truck. If exactly two trucks are parked, the fee is B won per minute for each truck. If all three trucks are parked, the fee is C won per minute for each truck.

Given A, B, C and the arrival and departure times of the three trucks, compute the total parking fee. A truck is considered parked from its arrival time up to, but not including, its departure time.

Input

The first line contains the parking fees A, B, and C separated by spaces. (1 <= C <= B <= A <= 100)

Each of the next three lines contains two integers: the arrival time and departure time of one truck. The arrival time is always earlier than the departure time, and every time is an integer from 1 to 100 inclusive.

Output

Print the total parking fee for the three trucks.