ZLOIers love playing League of Legends, but they seldom have time to play together.
When summer vacation came, each of them scheduled some free time for it, which could be described as an interval
)
(minute).
Now the

ZLOIers plan to play in

groups. Each group will play together when all the players in it are free.Each ZLOIer joins exactly one group, and each group has at least one
ZLOIer. The number of people in each group does not necessarily need to be equal.
Since they don't have a full plan of groups yet, they want you to maximize the total time the

groups can play.You should tell them
maximum total time.
Note that a group must play at least

minute, and the total time is not accumulated by each person, but by each group.