{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\nBob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especially in Mathematical Analysis.\n\u003c/p\u003e\n\n\u003cp\u003e\nAfter a mid-term exam, Bob was anxious about his grade. He went to the professor asking about the result of the exam. The professor said:\n\u003c/p\u003e\n\n\u003cblockquote\u003e\n\u003cp\u003e\n\"Too bad! You made me so disappointed.\"\n\u003c/p\u003e\n\u003cp\u003e\n\"Hummm... I am giving lessons to two classes. If you were in the other class, the average scores of both classes will increase.\"\n\u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003cp\u003e\nNow, you are given the scores of all students in the two classes, except for the Bob\u0027s. Please calculate the possible range of Bob\u0027s score. All scores shall be integers within [0, 100].\n\u003c/p\u003e\n\n\u003ch4\u003eInput\u003c/h4\u003e\n\n\u003cp\u003eThere are multiple test cases. The first line of input contains an integer \u003cvar\u003eT\u003c/var\u003e indicating the number of test cases. For each test case:\u003c/p\u003e\n\n\u003cp\u003e\nThe first line contains two integers \u003cvar\u003eN\u003c/var\u003e (2 \u0026lt;\u003d \u003cvar\u003eN\u003c/var\u003e \u0026lt;\u003d 50) and \u003cvar\u003eM\u003c/var\u003e (1 \u0026lt;\u003d \u003cvar\u003eM\u003c/var\u003e \u0026lt;\u003d 50) indicating the number of students in Bob\u0027s class and the number of students in the other class respectively.\n\u003c/p\u003e\n\n\u003cp\u003e\nThe next line contains \u003cvar\u003eN\u003c/var\u003e - 1 integers \u003cvar\u003eA\u003csub\u003e1\u003c/sub\u003e\u003c/var\u003e, \u003cvar\u003eA\u003csub\u003e2\u003c/sub\u003e\u003c/var\u003e, .., \u003cvar\u003eA\u003csub\u003eN-1\u003c/sub\u003e\u003c/var\u003e representing the scores of other students in Bob\u0027s class.\n\u003c/p\u003e\n\n\u003cp\u003e\nThe last line contains \u003cvar\u003eM\u003c/var\u003e integers \u003cvar\u003eB\u003csub\u003e1\u003c/sub\u003e\u003c/var\u003e, \u003cvar\u003eB\u003csub\u003e2\u003c/sub\u003e\u003c/var\u003e, .., \u003cvar\u003eB\u003csub\u003eM\u003c/sub\u003e\u003c/var\u003e representing the scores of students in the other class.\n\u003c/p\u003e\n\n\u003ch4\u003eOutput\u003c/h4\u003e\n\n\u003cp\u003e\nFor each test case, output two integers representing the minimal possible score and the maximal possible score of Bob.\n\u003c/p\u003e\n\n\u003cp\u003e\nIt is guaranteed that the solution always exists.\n\u003c/p\u003e\n\n\u003ch4\u003eSample\u003c/h4\u003e\n\u003ctable class\u003d\"vjudge_sample\"\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\u003e2\n4 3\n5 5 5\n4 4 3\n6 5\n5 5 4 5 3\n1 3 2 2 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4 4\n2 4\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n"}}]}