#P7189. [COCI 2007/2008 #6] PARKING

[COCI 2007/2008 #6] PARKING

Problem Description

Luka has graduated, and he found a job driving a truck.

One night, he parked 33 trucks in a parking lot, with fees charged as follows:

  • When 11 truck is parked, the driver pays aa dollars per minute for each truck.
  • When 22 trucks are parked, the driver pays bb dollars per minute for each truck.
  • When 33 trucks are parked, the driver pays cc dollars per minute for each truck.

Given a,b,ca, 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,ca, b, c, with meanings as described above.

The next three lines each contain 22 numbers, representing the parking start time beginibegin_i and end time endiend_i of the ii-th truck. The endiend_i-th minute is not charged.

Output Format

The first line contains one positive integer, indicating the amount of money Luka needs to pay.

5 3 1
1 6
3 5
2 8 

33
10 8 6
15 30
25 50
70 80 

480

Hint

Constraints

For 100%100\% of the testdata, 1cba1001 \le c \le b \le a \le 100, and 1beginiendi1001 \le begin_i \le end_i \le 100.

Notes

  • The full score for this problem is 2020 points.
  • This problem automatically enables the O2 optimization switch.
  • This problem is translated from COCI2007-2008 CONTEST #6 T1 PARKING, translated by
    https://www.luogu.com.cn/user/219791

Translated by ChatGPT 5