{"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\u003eAfter a hard struggle, DreamGrid was finally admitted to a university. Now he is having trouble calculating the limit of the ratio of two polynomials. Can you help him?\u003c/p\u003e\r\n\r\n\u003cp\u003eDreamGrid will give you two polynomials of a single variable \\(x\\) (eg. x^2-4x+7) or constant integers, and then he will tell you an integer \\(x_0\\). Your job is to find out the limit of a ratio consisting of these two polynomials (or constant integers) when \\(x\\) tends to \\(x_0\\). The first polynomial is the numerator and the second one is the denominator.\u003c/p\u003e\r\n\r\n\u003ch4\u003eInput\u003c/h4\u003e\r\n\u003cp\u003eThe first line of input contains an integer \\(T\\) (\\(1 \\le T \\le 50\\)), which indicates the number of test cases. For each test case:\u003c/p\u003e\r\n\r\n\u003cp\u003eThe first two lines describe two polynomials or constant integers, consisting of integers, \u0027x\u0027, \u0027+\u0027, \u0027-\u0027, and \u0027^\u0027 without any space. The coefficients range from -9 to 9, and the exponents range from 1 to 9 (If the exponent is 1, it will be omitted and won\u0027t be displayed as \u0027^1\u0027). The operaters will be seperated by integers or \u0027x\u0027 (You won\u0027t see \u0027-+x\u0027 in the input).\u003c/p\u003e\r\n\r\n\u003cp\u003eThe third line is the integer \\(x_0\\), ranging from -9 to 9.\u003c/p\u003e\r\n\r\n\u003cp\u003eIt\u0027s guaranteed that there won\u0027t be two same exponents in the same polynomial, and the numerator and denominator won\u0027t be both constant 0.\u003c/p\u003e\r\n\r\n\u003ch4\u003eOutput\u003c/h4\u003e\r\n\u003cp\u003eOutput 1 line for each case.\u003c/p\u003e\r\n\r\n\u003cp\u003eIf the limit exists, you should output it as the simplest fration (eg. -1, -1/6, 0, 3/2, 2, 3). Otherwise, output \"INF\" (not including the quotation marks).\u003c/p\u003e\r\n\r\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\r\nx^2-2x+1\r\nx^2-1\r\n1\r\n9x^8\r\n-9x^9\r\n9\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\r\n-1/9\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\r\n\u003ch4\u003eHint\u003c/h4\u003e\r\n\u003cp\u003e\\(\\lim\\limits_{x \\to 1}\\frac{x^2-2x+1}{x^2-1} \u003d 0\\), and \\(\\lim\\limits_{x \\to 9}\\frac{9x^8}{-9x^9} \u003d -\\frac{1}{9}\\).\r\n\u003c/p\u003e"}}]}