All Submissions


I think u all know the greatest Dota players of all the time Sunny Lalwani. Sunny has been playing too much Dota lately and forgotten that end sems are just about to begin and Sunny must pass. He has got only some hours (literally) to prepare for all the exams which he neccessarily has to pass.
Sunny has N courses (N<=10) which he needs to pass and definitely since he is a "greedy" guy he also wants to score as much as possible(in the totality, it's not that he favours some subject over others but he needs to pass them all anyway).
He has a total of M (M <=100) hours to study for all the exams combined.
Every course has 10 points associated to it.He needs to score at least 5 points out of 10 inorder to pass that course.
Rahul Prakash his good, generous and intelligent friend has prepared him a table L that will help him out for his preparation.
Each line of this table represents a course and each column represents a number of hours Sunny is preparing for a particular exam.
Element T(i,j) of the table means that if Sunny devoted j hours of his time for the ith subject , he scores L(i,j) points for the subject.
It is guaranteed that if sunny studies more number of hours for a particular subject he scores more, meaning L(i,j+1) >= L(i,j).
for all 1<=i<=N and 1<=j<=M-1

He asks for your help to help him in his goal of passing his exams and score highest possible marks as possible.

Input
First line consists of T(T<=500) denoting number of test case.
Each test case begins with two integers N and M.
Then N lines Follows each containing M integers denoting the elements of the table L(i,j).

Output
If Sunny manages to pass all the exams in M hours then print a single Integer denoting the maximum points he can score (out of 10*N).
Otherwise just print "Too much Dota." (quotes for clearity) to indicate that he could'nt pass because of playing excessive Dota.


Constraints

T<=500
N<=10
M<=100
L(i,j)<=10


Sample Input
2
4 5
5 5 6 7 8
5 5 6 7 8
5 6 7 8 8
6 7 8 9 9
4 5
4 5 6 7 8
4 5 6 7 8
5 6 7 8 8
6 7 8 9 9

Sample Output
22
Too much Dota.

Problem Setter : Arjun Singh Bhatia
Problem Source : Directi Algorithmic Interview



Languages: Brain,C,C++,Java,C#,JavaScript,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0