{"trustable":false,"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":"MD","content":"\u003cdiv class\u003d\"panel_content\"\u003e\n\n对于一个排列,我们可以按如下规则描述:如果相邻的两个位置,后者大于前者,则用\u0027I\u0027表示,否则用\u0027D\u0027表示。比如排列{3,1,2,7,4,6,5},可以描述为:\"DIIDID\"。按这种规则,给你一个描述,请求出有多少个排列符合这个描述规则。\n\u003c/div\u003e"}},{"title":"Input","value":{"format":"MD","content":"每组测试数据包含一个长度在[1, 1000]以内的字符串,其中只能出现\u0027I\u0027,\u0027D\u0027,\u0027?\u0027。\n 每组测试数据一行,前后都没有空格。\n\u0027?\u0027表示\u0027I\u0027或\u0027D\u0027中之一。"}},{"title":"Output","value":{"format":"MD","content":"对每组测试数据,输出一行,包含一个整数,表示符合描述规则的排列的数量。\n因为结果可能很大,你需要mod 1000000007.\n"}},{"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\u003e\u003cpre\u003eII\nID\nDI\nDD\n?D\n??\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e\u003cpre\u003e1\n2\n2\n1\n3\n6\n\u003c/pre\u003e\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Hint","value":{"format":"MD","content":"排列{1, 2, 3} 对应的描述为\"II\";\n排列{1, 3, 2} ,{2, 3, 1}对应的描述为\"ID\";\n排列{3, 1, 2} ,{2, 1, 3}对应的描述为\"DI\";\n排列{3, 2, 1}对应的描述为\"DD\".\n\"?D\"可以是\"ID\"或\"DD\".\n\"??\"可以可以描述所有的长度为3的排列。\n"}}]}