{"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\"\u003eMagina is surround by hundreds of monsters. Can he survive in T unit times?\u003cbr\u003eNow matter Magina or monster have three attributes(ATI, DEF, HP), but Magina have another attributes (MaxHP). Magina can own some equipments as a hero , there are six kinds of equipment \u003cb\u003e(\"Head\", \"Weapon\", \"Armor\",\"Shoes\", \"Trump\",\"Cuff\")\u003c/b\u003e in this world. Equipment have three attributes (A, D, MH), each standing the value can increase to ATI, DEF and MaxHP of Magina.\u003cbr\u003eTo every some kinds of equipment, Magina can only choose one to use. So when he have some kinds of equipments, he will choose the one have the bigger value. The value of equipments define as\u003cb\u003e A*3 + D*2 + MH\u003c/b\u003e. If the value of equipments is equal to the one Magina have, he will not choose to change his equipment.\u003cbr\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/9c918a62003e2a2310c786ce75882432?v\u003d1714265727\"\u003e\u003cbr\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/655fd66efd0178877b47079d67934cf1?v\u003d1714265727\"\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/6080bf5c28de6e7642058d4efb47b9a9?v\u003d1714265727\"\u003e\u003cbr\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/e17b007acc40510063d0a7b7842fbf89?v\u003d1714265727\"\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/68d87a2385d88c8fb810569ffa95df28?v\u003d1714265727\"\u003e\u003cbr\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/3a57f0031cdafee67e5f58f7d406a985?v\u003d1714265727\"\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/2e60d305ee00263dfafdfe68345dd6ed?v\u003d1714265727\"\u003e\u003cbr\u003eNow describe a fighting between A and B.\u003cbr\u003eWe know A hurt B first, the value of harm define as P. \u003cbr\u003e\u003cb\u003eP \u003d MAX(1,(int)((A\u0027s ATI - B\u0027s DEF) / ( abs(Xa-Xb) + abs(Ya-Yb) + 1))). \u003c/b\u003e (Xa,Ya) and (Xb,Yb) is the position of A and B. So B\u0027s HP will reduce P.\u003cbr\u003eThan B hurt A. A will loss MAX(1,(int)((B\u0027s ATI - A\u0027s DEF) / ( abs(Xa-Xb) + abs(Ya-Yb) + 1))).\u003cbr\u003eEvery one will die if his HP is small or equal to 0.\u003cbr\u003e\u003cbr\u003eIn the 2d-world. Magina standing in the position (0,0) and never moving, in T unit time, n monsters will move nearly to attack he. To every unit time we divide it to four processes.\u003cbr\u003eFirst Magina choose K monsters to attack once each continuously .(He will attack all if there are no K monsters survived ) If a monster die by attacking, he will drop a equipment. Than Magina can choose weather to use it. The way Magina choose is according to the P which is the value of his hurting to the monster. The first K higher monsters will be selected at the every unit time\u0027s begining, if two monsters have some P, the smaller ID of monsters will be selected. \u003cbr\u003eSecond every monster survived will hurt Magina once continuously. If Magina die, game over. \u003cbr\u003e\u003cbr\u003eThird every monster survived will move to Magina one unit. If the monster is standing the place of Magina, he will not move. One unit is meaning X or Y to change only one.\u003cbr\u003e\u003cbr\u003eFourth Magina will revert W HP. \u003cb\u003eW \u003d (int) ( MaxHP*0.05 ).\u003c/b\u003e The maximum of HP can not bigger than MaxHP.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains multiple test cases.\u003cbr\u003eFirst line give the integer n (1\u0026lt;\u003d n \u0026lt;\u003d400)\u003cbr\u003eNext line ATI, DEF, MaxHP,K,T. (T\u0026lt;\u003d100). Magina is HP \u003d MaxHP and have no equipment at the begin.\u003cbr\u003eNext follow n line, each line expressing a monster by increasint ID.The input form as ATI, DEF,HP,X,Y, Kind\u0027smane, A, D, MH. All integer are nonnegative.Last four expressing the equipment this monster owned.Kind\u0027smane is the kind name of equipment.It can only be one of six describing foregoing\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"Output the information of Magina\u0027s equipment during the T unit times.\u003cbr\u003eIf Magina use a equipment when he have no this kind of equipment, Output \u003cb\u003e“Magina get the Sname”\u003c/b\u003e.\u003cbr\u003eIf Magina use a new well equipment, output\u003cb\u003e\"Magina update the Sname\"\u003c/b\u003e, Sname is the kind name of six equipments. \u003cbr\u003eLast Output \u003cb\u003e\"Magina death !\"\u003c/b\u003e if Magina is death .Otherwise output \u003cb\u003e\"Magina killed Num Monster!\"\u003c/b\u003e,Num is a numbers of monsters Magina killed during T unit times. \u003cbr\u003eEvery case follow a blank.\u003cbr\u003e"}},{"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\n30 2 100 1 3\r\n3 0 10 2 2 Head 1 0 0\r\n\r\n5\r\n192 114 29 3 64\r\n22 3 140 15 5 Head 32 18 4\r\n45 15 114 4 11 Trump 34 47 48\r\n44 9 186 19 2 Cuff 28 46 12\r\n32 3 2 10 18 Armor 45 40 15\r\n27 3 104 1 3 Trump 37 2 22\r\n\r\n5\r\n30 130 33 2 85\r\n34 4 163 13 15 Head 32 9 15\r\n11 3 8 3 12 Cuff 7 22 4\r\n11 14 143 3 18 Weapon 48 17 35\r\n5 14 27 10 1 Cuff 9 25 41\r\n34 17 135 13 1 Weapon 48 0 33\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eMagina get the Head\r\nMagina killed 1 Monster!\r\n\r\nMagina get the Trump\r\nMagina update the Trump\r\nMagina get the Armor\r\nMagina get the Head\r\nMagina get the Cuff\r\nMagina killed 5 Monster!\r\n\r\nMagina get the Cuff\r\nMagina death !\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}