{"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\u003eOnce Petya read a problem about a bracket sequence. He gave it much thought but didn\u0027t find a solution. Today you will face it.\u003c/p\u003e\u003cp\u003eYou are given string \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e\u003c/span\u003e. It represents a correct bracket sequence. A correct bracket sequence is the sequence of opening (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e(\u003c/span\u003e\") and closing (\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e)\u003c/span\u003e\") brackets, such that it is possible to obtain a correct mathematical expression from it, inserting numbers and operators between the brackets. For example, such sequences as \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e(())()\u003c/span\u003e\" and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e()\u003c/span\u003e\" are correct bracket sequences and such sequences as \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e)()\u003c/span\u003e\" and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e(()\u003c/span\u003e\" are not.\u003c/p\u003e\u003cp\u003eIn a correct bracket sequence each bracket corresponds to the matching bracket (an opening bracket corresponds to the matching closing bracket and vice versa). For example, in a bracket sequence shown of the figure below, the third bracket corresponds to the matching sixth one and the fifth bracket corresponds to the fourth one.\u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/a6b8d63ccf43a76ac950f6a9f1b9407e?v\u003d1715478495\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e \u003cp\u003eYou are allowed to color some brackets in the bracket sequence so as all three conditions are fulfilled: \u003c/p\u003e\u003cul\u003e \u003cli\u003e Each bracket is either not colored any color, or is colored red, or is colored blue. \u003c/li\u003e\u003cli\u003e For any pair of matching brackets exactly one of them is colored. In other words, for any bracket the following is true: either it or the matching bracket that corresponds to it is colored. \u003c/li\u003e\u003cli\u003e No two neighboring colored brackets have the same color. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eFind the number of different ways to color the bracket sequence. The ways should meet the above-given conditions. Two ways of coloring are considered different if they differ in the color of at least one bracket. As the result can be quite large, print it modulo \u003cspan class\u003d\"tex-span\"\u003e1000000007\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e10\u003csup class\u003d\"upper-index\"\u003e9\u003c/sup\u003e + 7\u003c/span\u003e).\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains the single string \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003es\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e2 ≤ |\u003ci\u003es\u003c/i\u003e| ≤ 700\u003c/span\u003e) which represents a correct bracket sequence. \u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint the only number — the number of ways to color the bracket sequence that meet the above given conditions modulo \u003cspan class\u003d\"tex-span\"\u003e1000000007\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e10\u003csup class\u003d\"upper-index\"\u003e9\u003c/sup\u003e + 7\u003c/span\u003e).\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\u003e(())\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e12\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\u003e(()())\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e40\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\u003e()\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\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\u003eLet\u0027s consider the first sample test. The bracket sequence from the sample can be colored, for example, as is shown on two figures below. \u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/4399a47b86d784c277acf53b136c6401?v\u003d1715478495\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/7a03d539d1d681eee4497cfa5c1ed684?v\u003d1715478495\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e \u003cp\u003eThe two ways of coloring shown below are incorrect. \u003c/p\u003e\u003ccenter\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/6e03de2eb570c8a20504c3d70355d50c?v\u003d1715478495\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003cimg class\u003d\"tex-graphics\" src\u003d\"CDN_BASE_URL/3fa44dba87152fc9c3181c54c2c20497?v\u003d1715478495\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \u003c/center\u003e "}}]}