Student Z doesn't love exams
The exam was about to be done soon, but student Z didn't even read the book, He had collapsed.
Student Z has a total of $n$ exams, and there are still $t$ days before the start of the exam, which means he still has $t$ days to PREVIEW.
But student Z couldn’t even read the textbooks, and couldn’t review it at all. Fortunately, a kind classmate gave him $m$ sets of review materials. The $i$ set of materials can improve the grades of the $s_i$ course. The $i$ set of materials needs to be studied for $y_i$ days. You can increase $x_i$ points later (the upper limit of each course is $100$ points, so after it is upgraded to $100$ points, there will be no further increase).and note that each set of review materials can only be used once.
Student Z now has a zero-point level in every course. it is impossible to review all the materials, so he needs to choose some materials to review, but he can fail at most $p$ courses in this semester (if the score of one course is less than 60 points will fail), otherwise he will be talked to by the professor.
Student Z now wants to know the maximum points he can get in all courses under the premise of fail no more than $p$ courses this semester. If he cannot meet the conditions, please output $ -1 $ .