{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv\u003e\u003cp\u003eSort the first \u003ci\u003en\u003c/i\u003e integers 1,2,3,...,\u003ci\u003en\u003c/i\u003e-1,\u003ci\u003en\u003c/i\u003e in lexicographical order, and the \u003ci\u003ek\u003c/i\u003e-th integer is known as \u003ci\u003em\u003c/i\u003e. Can you tell me the smallest \u003ci\u003en\u003c/i\u003e? \u003c/p\u003e\u003cp\u003eFor example,when n\u003d11, the order is 1, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9. And the 4-th integer is 2. \u003c/p\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv\u003e\u003cp\u003eThe input contains many test cases ended with EOF. Each test case contains only one line of two integers, \u003ci\u003ek\u003c/i\u003e and \u003ci\u003em\u003c/i\u003e. \u003c/p\u003e\u003cp\u003e1 ≤ \u003ci\u003ek\u003c/i\u003e, \u003ci\u003em\u003c/i\u003e ≤ 10^9 \u003c/p\u003e\u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv\u003e\u003cp\u003eFor each test case output the smallest \u003ci\u003en\u003c/i\u003e in a single line. If there is no such \u003ci\u003en\u003c/i\u003e, just output 0. \u003c/p\u003e\u003c/div\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\u003e4 2\r\n2 1\r\n1000 25\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e11\r\n0\r\n1831\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}