{"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\"\u003eThese days Lotus is interested in cultivating potted plants, so she wants to build a greenhouse to meet her research desires.\u003cbr\u003e\u003cbr\u003eLotus placed all of the $n$ pots in the new greenhouse, so all potted plants were in the same environment.\u003cbr\u003e\u003cbr\u003eEach plant has an optimal growth temperature range of $[l, r]$, which grows best at this temperature range, but does not necessarily provide the best research value (Lotus thinks that researching poorly developed potted plants are also of great research value).\u003cbr\u003e\u003cbr\u003eLotus has carried out a number of experiments and found that if the growth temperature of the i-th plant is suitable, it can provide $a_i$ units of research value; if the growth temperature exceeds the upper limit of the suitable temperature, it can provide the $b_i$ units of research value; temperatures below the lower limit of the appropriate temperature, can provide $c_i$ units of research value.\u003cbr\u003e\u003cbr\u003eNow, through experimentation, Lotus has known the appropriate growth temperature range for each plant, and the values of $a$, $b$, $c$ are also known. You need to choose a temperature for the greenhouse based on these information, providing Lotus with the maximum research value.\u003cbr\u003e\u003cbr\u003e__NOTICE: the temperature can be any real number.__\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input includes multiple test cases. The first line contains a single integer $T$, the number of test cases.\u003cbr\u003e\u003cbr\u003eThe first line of each test case contains a single integer $n\\in[1,50000]$, the number of potted plants.\u003cbr\u003e\u003cbr\u003eThe next $n$ line, each line contains five integers $l_i,r_i,a_i,b_i,c_i\\in[1, 10^9]$.\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print one line of one single integer presenting the answer.\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\n5\r\n5 8 16 20 12\r\n10 16 3 13 13\r\n8 11 13 1 11\r\n7 9 6 17 5\r\n2 11 20 8 5\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e83\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}