{"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\"\u003eJenny is a warehouse keeper. He writes down the entry records everyday. The record is shown on a screen, as follow:\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/c559ce3b996341df073826a62055d274?v\u003d1715485055\"\u003e\u003c/center\u003e \u003cbr\u003eThere are only two buttons on the screen. Pressing the button in the first line once increases the number on the first line by 1. The cost per unit remains untouched. For the screen above, after the button in the first line is pressed, the screen will be:\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/215039d796dec466ea0f816066bc271a?v\u003d1715485055\"\u003e\u003c/center\u003e \u003cbr\u003eThe exact total price is 7.5, but on the screen, only the integral part 7 is shown.\u003cbr\u003ePressing the button in the second line once increases the number on the second line by 1. The number in the first line remains untouched. For the screen above, after the button in the second line is pressed, the screen will be:\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/51aae235d404432f1b76081ef5679c81?v\u003d1715485055\"\u003e\u003c/center\u003e \u003cbr\u003eRemember the exact total price is 8.5, but on the screen, only the integral part 8 is shown. \u003cbr\u003eA new record will be like the following:\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/d4bd4553f56904448972860fc35fb6f3?v\u003d1715485055\"\u003e\u003c/center\u003e \u003cbr\u003eAt that moment, the total price is exact 1.0.\u003cbr\u003eJenny expects a final screen in form of:\u003cbr\u003e\u003ccenter\u003e\u003cimg style\u003d\"max-width:100%;\" src\u003d\"CDN_BASE_URL/c4f0fe8d56260a3c6660e87bf83062fb?v\u003d1715485055\"\u003e\u003c/center\u003e \u003cbr\u003eWhere x and y are previously given.\u003cbr\u003eWhat’s the minimal number of pressing of buttons Jenny needs to achieve his goal?\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"There are several (about 50, 000) test cases, please process till EOF.\u003cbr\u003eEach test case contains one line with two integers x(1 \u0026lt;\u003d x \u0026lt;\u003d 10) and y(1 \u0026lt;\u003d y \u0026lt;\u003d 10\u003csup\u003e9\u003c/sup\u003e) separated by a single space - the expected number shown on the screen in the end."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, print the minimal number of pressing of the buttons, or “-1”(without quotes) if there’s no way to achieve his goal."}},{"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 1\r\n3 8\r\n9 31\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\r\n5\r\n11\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cbr\u003eFor the second test case, one way to achieve is:\u003cbr\u003e(1, 1) -\u0026gt; (1, 2) -\u0026gt; (2, 4) -\u0026gt; (2, 5) -\u0026gt; (3, 7.5) -\u0026gt; (3, 8.5)\u003cbr\u003e"}}]}