{"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\u003eThe math faculty of Berland State University has suffered the sudden drop in the math skills of enrolling students. This year the highest grade on the entrance math test was 8. Out of 100! Thus, the decision was made to make the test easier.\u003c/p\u003e\u003cp\u003eFuture students will be asked just a single question. They are given a sequence of integer numbers $$$a_1, a_2, \\dots, a_n$$$, each number is from $$$1$$$ to $$$3$$$ and $$$a_i \\ne a_{i + 1}$$$ for each valid $$$i$$$. The $$$i$$$-th number represents a type of the $$$i$$$-th figure:\u003c/p\u003e\u003col\u003e \u003cli\u003e circle; \u003c/li\u003e\u003cli\u003e isosceles triangle with the length of height equal to the length of base; \u003c/li\u003e\u003cli\u003e square. \u003c/li\u003e\u003c/ol\u003e\u003cp\u003eThe figures of the given sequence are placed somewhere on a Cartesian plane in such a way that:\u003c/p\u003e\u003cul\u003e \u003cli\u003e $$$(i + 1)$$$-th figure is inscribed into the $$$i$$$-th one; \u003c/li\u003e\u003cli\u003e each triangle base is parallel to OX; \u003c/li\u003e\u003cli\u003e the triangle is oriented in such a way that the vertex opposite to its base is at the top; \u003c/li\u003e\u003cli\u003e each square sides are parallel to the axes; \u003c/li\u003e\u003cli\u003e for each $$$i$$$ from $$$2$$$ to $$$n$$$ figure $$$i$$$ has the maximum possible length of side for triangle and square and maximum radius for circle. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cspan class\u003d\"tex-font-style-it\"\u003eNote that the construction is unique for some fixed position and size of just the first figure.\u003c/span\u003e\u003c/p\u003e\u003cp\u003eThe task is to calculate the number of \u003cspan class\u003d\"tex-font-style-bf\"\u003edistinct\u003c/span\u003e points (not necessarily with integer coordinates) where figures touch. The trick is, however, that the number is sometimes infinite. But that won\u0027t make the task difficult for you, will it?\u003c/p\u003e\u003cp\u003eSo can you pass the math test and enroll into Berland State University?\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single integer $$$n$$$ ($$$2 \\le n \\le 100$$$) — the number of figures.\u003c/p\u003e\u003cp\u003eThe second line contains $$$n$$$ integer numbers $$$a_1, a_2, \\dots, a_n$$$ ($$$1 \\le a_i \\le 3$$$, $$$a_i \\ne a_{i + 1}$$$) — types of the figures.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eThe first line should contain either the word \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eInfinite\u003c/span\u003e\" if the number of distinct points where figures touch is infinite or \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eFinite\u003c/span\u003e\" otherwise.\u003c/p\u003e\u003cp\u003eIf the number is finite than print it in the second line. It\u0027s guaranteed that the number fits into 32-bit integer type.\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\u003e3\n2 1 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eFinite\n7\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\u003e3\n1 2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eInfinite\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\u003eHere are the glorious pictures for the examples. Note that the triangle is not equilateral but just isosceles with the length of height equal to the length of base. Thus it fits into a square in a unique way.\u003c/p\u003e\u003cp\u003eThe distinct points where figures touch are marked red.\u003c/p\u003e\u003cp\u003eIn the second example the triangle and the square touch each other for the whole segment, it contains infinite number of points.\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/a934a32b5bba9478e91c0b550169ca88?v\u003d1714144047\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e"}}]}