{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eIn an online game, \"Lead of Wisdom\" is a place where the lucky player can randomly get powerful items.\u003cbr\u003e\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/6ea376836b3d4f500eab75f1faed94ce?v\u003d1715766886\"\u003e\u003c/center\u003e\u003cbr\u003e\u003cbr\u003eThere are $k$ types of items, a player can wear at most one item for each type. For the $i$-th item, it has four attributes $a_i,b_i,c_i$ and $d_i$. Assume the set of items that the player wearing is $S$, the damage rate of the player $DMG$ can be calculated by the formula:\u003cbr\u003e\u003cbr\u003e\\[DMG\u003d\\left(100+\\sum_{i\\in S} a_i\\right)\\left(100+\\sum_{i\\in S} b_i\\right)\\left(100+\\sum_{i\\in S} c_i\\right)\\left(100+\\sum_{i\\in S} d_i\\right)\\]\u003cbr\u003e\u003cbr\u003eLittle Q has got $n$ items from \"Lead of Wisdom\", please write a program to help him select which items to wear such that the value of $DMG$ is maximized.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains a single integer $T$ ($1 \\leq T \\leq 10$), the number of test cases.\u003cbr\u003e\u003cbr\u003eFor each case, the first line of the input contains two integers $n$ and $k$ ($1 \\leq n,k \\leq 50$), denoting the number of items and the number of item types.\u003cbr\u003e\u003cbr\u003eEach of the following $n$ lines contains five integers $t_i,a_i,b_i,c_i$ and $d_i$ ($1\\leq t_i\\leq k$, $0\\leq a_i,b_i,c_i,d_i\\leq 100$), denoting an item of type $t_i$ whose attributes are $a_i,b_i,c_i$ and $d_i$."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, output a single line containing an integer, the maximum value of $DMG$."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n6 4\r\n1 17 25 10 0\r\n2 0 0 25 14\r\n4 17 0 21 0\r\n1 5 22 0 10\r\n2 0 16 20 0\r\n4 37 0 0 0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e297882000\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}