{"trustable":true,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\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 type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eVasya studies divisibility rules at school. Here are some of them:\u003c/p\u003e\u003cul\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e if and only if its last digit is divisible by \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e or in other words, is even.\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e if and only if the sum of its digits is divisible by \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e.\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e if and only if its last two digits form a number that is divisible by \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e.\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e if and only if its last digit equals \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e or \u003cspan class\u003d\"tex-span\"\u003e0\u003c/span\u003e.\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e6\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e6\u003c/span\u003e if and only if it is divisible by \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e simultaneously (that is, if the last digit is even and the sum of all digits is divisible by \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e).\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e7\u003c/span\u003e.\u003c/span\u003e Vasya doesn\u0027t know such divisibility rule.\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e8\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e8\u003c/span\u003e if and only if its last three digits form a number that is divisible by \u003cspan class\u003d\"tex-span\"\u003e8\u003c/span\u003e.\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e9\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e9\u003c/span\u003e if and only if the sum of its digits is divisible by \u003cspan class\u003d\"tex-span\"\u003e9\u003c/span\u003e.\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e10\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e10\u003c/span\u003e if and only if its last digit is a zero.\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-it\"\u003eDivisibility by \u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e.\u003c/span\u003e A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e if and only if the sum of digits on its odd positions either equals to the sum of digits on the even positions, or they differ in a number that is divisible by \u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eVasya got interested by the fact that some divisibility rules resemble each other. In fact, to check a number\u0027s divisibility by \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e, \u003cspan class\u003d\"tex-span\"\u003e4\u003c/span\u003e, \u003cspan class\u003d\"tex-span\"\u003e5\u003c/span\u003e, \u003cspan class\u003d\"tex-span\"\u003e8\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e10\u003c/span\u003e it is enough to check fulfiling some condition for one or several last digits. Vasya calls such rules the \u003cspan class\u003d\"tex-font-style-bf\"\u003e\u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e-type\u003c/span\u003e rules.\u003c/p\u003e\u003cp\u003eIf checking divisibility means finding a sum of digits and checking whether the sum is divisible by the given number, then Vasya calls this rule the \u003cspan class\u003d\"tex-font-style-bf\"\u003e\u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e-type\u003c/span\u003e rule (because it works for numbers \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e9\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eIf we need to find the difference between the sum of digits on odd and even positions and check whether the difference is divisible by the given divisor, this rule is called the \u003cspan class\u003d\"tex-font-style-bf\"\u003e\u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e-type\u003c/span\u003e rule (it works for number \u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eIn some cases we should divide the divisor into several factors and check whether rules of different types (\u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e-type, \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e-type or \u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e-type) work there. For example, for number \u003cspan class\u003d\"tex-span\"\u003e6\u003c/span\u003e we check \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e-type and \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e-type rules, for number \u003cspan class\u003d\"tex-span\"\u003e66\u003c/span\u003e we check all three types. Such mixed divisibility rules are called \u003cspan class\u003d\"tex-font-style-bf\"\u003e\u003cspan class\u003d\"tex-span\"\u003e6\u003c/span\u003e-type\u003c/span\u003e rules. \u003c/p\u003e\u003cp\u003eAnd finally, there are some numbers for which no rule works: neither \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e-type, nor \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e-type, nor \u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e-type, nor \u003cspan class\u003d\"tex-span\"\u003e6\u003c/span\u003e-type. The least such number is number \u003cspan class\u003d\"tex-span\"\u003e7\u003c/span\u003e, so we\u0027ll say that in such cases the mysterious \u003cspan class\u003d\"tex-font-style-bf\"\u003e\u003cspan class\u003d\"tex-span\"\u003e7\u003c/span\u003e-type\u003c/span\u003e rule works, the one that Vasya hasn\u0027t discovered yet. \u003c/p\u003e\u003cp\u003eVasya\u0027s dream is finding divisibility rules for all possible numbers. He isn\u0027t going to stop on the decimal numbers only. As there are quite many numbers, ha can\u0027t do it all by himself. Vasya asked you to write a program that determines the divisibility rule type in the \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eb\u003c/i\u003e\u003c/span\u003e-based notation for the given divisor \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ed\u003c/i\u003e\u003c/span\u003e.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first input line contains two integers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eb\u003c/i\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ed\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e2 ≤ \u003ci\u003eb\u003c/i\u003e, \u003ci\u003ed\u003c/i\u003e ≤ 100\u003c/span\u003e) — the notation system base and the divisor. Both numbers are given in the decimal notation.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eOn the first output line print the type of the rule in the \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eb\u003c/i\u003e\u003c/span\u003e-based notation system, where the divisor is \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ed\u003c/i\u003e\u003c/span\u003e: \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e2-type\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e3-type\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e11-type\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e6-type\u003c/span\u003e\" or \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e7-type\u003c/span\u003e\". If there are several such types, print the one that goes earlier in the given sequence. If a number belongs to the \u003cspan class\u003d\"tex-span\"\u003e2\u003c/span\u003e-type, print on the second line the least number of the last \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eb\u003c/i\u003e\u003c/span\u003e-based digits that we will need to use to check the divisibility.\u003c/p\u003e"}},{"title":"Examples","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\u003e10 10\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2-type\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e11-type\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe divisibility rule for number \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e in binary notation looks as follows: \"A number is divisible by \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e if and only if the sum of its digits that occupy the even places differs from the sum of digits that occupy the odd places, in a number that is divisible by \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e\". That\u0027s an \u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e-type rule. For example, \u003cspan class\u003d\"tex-span\"\u003e21\u003csub class\u003d\"lower-index\"\u003e10\u003c/sub\u003e \u003d 10101\u003csub class\u003d\"lower-index\"\u003e2\u003c/sub\u003e\u003c/span\u003e. For it the sum of digits on odd positions equals \u003cspan class\u003d\"tex-span\"\u003e1 + 1 + 1 \u003d 3\u003c/span\u003e, an on even positions — \u003cspan class\u003d\"tex-span\"\u003e0 + 0 \u003d 0\u003c/span\u003e. The rule works and the number is divisible by \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e. \u003c/p\u003e\u003cp\u003eIn some notations a number can fit into the \u003cspan class\u003d\"tex-span\"\u003e3\u003c/span\u003e-type rule and the \u003cspan class\u003d\"tex-span\"\u003e11\u003c/span\u003e-type rule. In this case the correct answer is \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e3-type\u003c/span\u003e\".\u003c/p\u003e"}}]}