Teamwork is critical in programming competitions! Effective communication and solution discussion among team members is key before implementation. Sometimes, team members might choose incorrect solutions and spend excessive time coding them. Other times, someone may suggest a more straightforward and simpler approach.
A team of three members is taking part in the competition. For each team member, you are given the time it takes for them to implement each of the problems. However, they share just one computer, so they could only work on one problem at a time. The contest has a duration of $$$300$$$ minutes. Your task is to compute the maximum number of different problems the team can solve. You can neglect the time required for switching between problems — if the total time required for solving problems doesn't exceed $$$300$$$ minutes, they could do it in time.
Let's look at the sample:
The first line contains one integer $$$n$$$ ($$$1 \le n \le 14$$$) — the number of problems in the contest.
Each of the next $$$n$$$ lines contains the description of the problem $$$name$$$ $$$t_1$$$ $$$t_2$$$ $$$t_3$$$ ($$$-1 \le t_i \le 300$$$) — the problem's name and the number of minutes required for each participant to implement it. The problem name consists of at most $$$30$$$ alphanumeric characters. If $$$t_i$$$ equals $$$-1$$$, this team member could not implement this problem at all.
Print single integer — the maximum number of problems the team could solve during the contest.
13AplusB -1 20 -1TheBestWife 80 90 60Cardinality 40 50 303D 40 -1 70EqualStrings 25 15 20FastTreeQueries 120 -1 40GeoSharding 25 20 30HaveYouSeenThisSubarray 80 90 60InteractiveCasino 50 20 30JigsawPuzzle 40 50 80Knapsack -1 40 200LondonUnderground -1 200 40Meta 5 7 10
10