{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"We know, a number is said to be divisible by another number if the remainder is 0. But My friend Sajjad think up an interesting law, \"If an integer is not divisible by 2 or 5, there will be some multiple of that number in decimal notation with a sequence of only a digit.\"\n\nFor example, you have to find a multiple of 3 which contains only 1\u0027s. Then the result 111 (3-digit) divisible by 3. Similarly, if you are finding some multiple of 7 which contains only 3\u0027s then, the result is 333333 which is divisible by 7.\n\nNow, Sajjad give me the number and the only allowable digit and told to report the number of digits of such a multiple.\nYou know, i am weak in mathematics. So, you should help me to solve this problem."}},{"title":"Input","value":{"format":"MD","content":"Input starts with an integer **T (\u0026le; 300)**, denoting the number of test cases.\n\nEach case will contain two integers **n (0 \u0026lt; n \u0026le; 10\u003csup\u003e6\u003c/sup\u003e** and **n** will not be divisible by **2** or **5**) and the allowable digit **(1 \u0026le; digit \u0026le; 9)**."}},{"title":"Output","value":{"format":"MD","content":"For each case, print the case number and the number of digits of such multiple. If several solutions are there; report the minimum one."}},{"title":"Sample","value":{"format":"MD","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\u003e3\n3 1\n7 3 \n9901 1\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1: 3\nCase 2: 6\nCase 3: 12\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"MD","content":"* For case 1, 111 is the smallest integer, and it contains 3 digits.\n* For case 2, 333333 is the smallest integer, and it contains 6 digits."}}]}