other teammates are kemonomimi.
is participating in the Educational Computing Olympiad for Otakus (ECOO). It seemed to him that he was in yet another ordinary competition to fly through when he realizes that hisThe contest consists of problems, with a maximum of submissions available per problem per team. While was napping, his teammates started without him! Each of the problems was attempted exactly once, with the kemonomimi's submission for the problem receiving points.
problems provided that he has enough time. However, just the thought of having such beautiful anthropomorphic females on the same team as himself is enough to drive insane! Each of the kemonomimi has her own cuteness factor which increases the time he takes to produce his solution by .
is able to concurrently solve allHaving exhausted all of their energy, the kemonomimi could no longer concentrate on the tasks at hand and called upon their teammate hours, would really like to know how many additional points he can earn.
to finish the contest. Not wanting to waste any more of the time remaining of the originalInput Specification
The first line of input contains .
The second line of input contains space-separated integers , representing the cuteness factor of the kemonomimi.
The next lines contain space-separated integers , , , describing the problem:
, identifying the kemonomimi who worked on the first submission of this problem;
, the amount of points (out of a maximum of ), the first submission received;
, the time elapsed in minutes from the start of the competition to the end of the first submission;
, the amount of time in minutes needs to finish coding the solution to the problem undisturbed;
Output Specification
Output lines, the of which represents the number of additional points can earn concurrently for the problem.
Output The kemonomimi are too cute!
instead if the problem cannot successfully be solved in time.
Sample Input
3
1 3 6 9
2 1 0 20
3 3 120 1
4 9 75 12
Sample Output
9
7
The kemonomimi are too cute!
Explanation for Sample Output
hours after the start of the competition! The kemonomimi woke him up after their last submission, minutes into the competition.
starts programming concurrentlyThe second kemonomimi contributed to the first problem and her lingering aura of cuteness triples the time taken for minutes to solve this problem, finishing just as the contest ends!
to type up a solution; Therefore, it takesThe second problem was attempted by the third kemonomimi, taking minutes to solve.
Unfortunately, the cuteness of the fourth kemonomimi was just too much for
to bear, and he is unable to solve the third problem in time.jolts awake in his bed, drenched in sweat. What a horrible nightmare!
...
nyah~
Comments
discrepancy detected
kyaaan~
To clarify, the time at which FatalEagle begins working on the problems concurrently is the latest of all the submission times? So if S = [3, 10, 20, 50, 2], he would start at 50 minutes?
Yes he would. As the Explanation for the Sample Output states, for , he would begin minutes into the competition.