P7189 [COCI 2007/2008 #6] PARKING
Description
Luka has graduated, and he found a job driving a truck.
One night, he parked $3$ trucks in a parking lot, with fees charged as follows:
- When $1$ truck is parked, the driver pays $a$ dollars per minute for each truck.
- When $2$ trucks are parked, the driver pays $b$ dollars per minute for each truck.
- When $3$ trucks are parked, the driver pays $c$ dollars per minute for each truck.
Given $a, b, c$ and the parking times of Luka's three trucks, determine how much Luka needs to pay.
Input Format
The first line contains $a, b, c$, with meanings as described above.
The next three lines each contain $2$ numbers, representing the parking start time $begin_i$ and end time $end_i$ of the $i$-th truck. The $end_i$-th minute is not charged.
Output Format
The first line contains one positive integer, indicating the amount of money Luka needs to pay.
Explanation/Hint
#### Constraints
For $100\%$ of the testdata, $1 \le c \le b \le a \le 100$, and $1 \le begin_i \le end_i \le 100$.
#### Notes
- The full score for this problem is $20$ points.
- This problem automatically enables the O2 optimization switch.
- This problem is translated from [COCI2007-2008](https://hsin.hr/coci/archive/2007_2008/) [CONTEST #6](https://hsin.hr/coci/archive/2007_2008/contest6_tasks.pdf) T1 PARKING, translated by @[tearing](https://www.luogu.com.cn/user/219791).
Translated by ChatGPT 5