{"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\"\u003eIn the math class, the evil teacher gave you one unprecedented problem!\u003cbr\u003e\u003cbr\u003eHere f(n) is the n-th fibonacci number (n \u0026gt;\u003d 0)! Where f(0) \u003d f(1) \u003d 1 and for any n \u0026gt; 1, f(n) \u003d f(n - 1) + f(n - 2). For example, f(2) \u003d 2, f(3) \u003d 3, f(4) \u003d 5 ...\u003cbr\u003e\u003cbr\u003eThe teacher used to let you calculate f(n) mod p where n \u0026lt;\u003d 10^18 and p \u0026lt;\u003d 10^9, however , as an ACMER, you may just kill it in seconds! The evil teacher is mad about this. Now he let you find the smallest integer m (m \u0026gt; 0) such that for ANY non-negative integer n ,f(n) \u003d f(n + m) (mod p) . For example, if p \u003d 2, then we could find know m \u003d 3 , f(0) \u003d f(3) \u003d 1(mod 2), f(1) \u003d f(4) (mod 2) ....\u003cbr\u003e\u003cbr\u003eNow the evil teacher will only give you one integer p( p \u0026lt;\u003d 2* 10^9), will you tell him the smallest m you can find ? \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line is one integer T indicates the number of the test cases. (T \u0026lt;\u003d20)\u003cbr\u003e\u003cbr\u003eThen for every case, only one integer P . (1 \u0026lt;\u003d P \u0026lt;\u003d 2 * 10^9, the max prime factor for P is no larger than 10^6)"}},{"title":"Output","value":{"format":"HTML","content":"Output one line.\u003cbr\u003e\u003cbr\u003eFirst output “Case #idx: ”, here idx is the case number count from 1.Then output the smallest m you can find. You can assume that the m is always smaller than 2^64 ."}},{"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\u003e5 \r\n11 \r\n19 \r\n61 \r\n17 \r\n67890\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 10 \r\nCase #2: 18 \r\nCase #3: 60 \r\nCase #4: 36 \r\nCase #5: 4440\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}