{"trustable":false,"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\u003e对于一个长度为 \u003cb\u003en\u003c/b\u003e 且只包含小写字母的字符串,已知这个字符串的一个子串 \u003cb\u003ep\u003c/b\u003e,以及这一子串在原串中出现的一部分位置(也可能是全部)。\u003c/p\u003e\n\u003cp\u003e求原串可能的方案数,答案可能很大,输出答案对 \u003cb\u003e10\u003csup\u003e9\u003c/sup\u003e + 7\u003c/b\u003e 取模的结果。\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e第一行有两个整数 \u003cb\u003en\u003c/b\u003e, \u003cb\u003em\u003c/b\u003e (\u003cb\u003e1 \u0026leq; n \u0026leq; 10\u003csup\u003e6\u003c/sup\u003e\u003c/b\u003e, \u003cb\u003e0 \u0026leq; m \u0026leq; n - |p| + 1\u003c/b\u003e),表示原串的长度以及子串出现的部分位置数。\u003c/p\u003e\n\u003cp\u003e第二行为子串 \u003cb\u003ep\u003c/b\u003e (\u003cb\u003e1 \u0026leq; |p| \u0026leq; n\u003c/b\u003e)。\u003c/p\u003e\n\u003cp\u003e第三行包含 \u003cb\u003em\u003c/b\u003e 个整数 \u003cb\u003ey\u003csub\u003ei\u003c/sub\u003e\u003c/b\u003e (\u003cb\u003e1 \u0026leq; y\u003csub\u003e1\u003c/sub\u003e \u0026lt; y\u003csub\u003e2\u003c/sub\u003e \u0026lt; ... \u0026lt; y\u003csub\u003em\u003c/sub\u003e \u0026leq; n - |p| + 1\u003c/b\u003e),依次表示子串出现的位置。\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e输出一行一个整数,表示方案数对 \u003cb\u003e10\u003csup\u003e9\u003c/sup\u003e + 7\u003c/b\u003e 取模的结果。\u003c/p\u003e"}},{"title":"Examples","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e \n \u003cdiv class\u003d\"input\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e \n \u003cpre\u003e6 2\u003cbr\u003eioi\u003cbr\u003e1 3\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e \n \u003cdiv class\u003d\"output\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e \n \u003cpre\u003e26\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e \n \u003cdiv class\u003d\"input\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e \n \u003cpre\u003e5 2\u003cbr\u003eioi\u003cbr\u003e1 2\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e \n \u003cdiv class\u003d\"output\"\u003e \n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e \n \u003cpre\u003e0\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003e对于样例 1,可能的结果为 \u003cb\u003e\"ioioi?\"\u003c/b\u003e,其中问号代表任意小写字母。\u003c/p\u003e \n\u003cp\u003e注意,满足条件的原串可能不存在,参考样例 2。\u003c/p\u003e"}}]}