{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eYou are given a string $$$s$$$ consisting of lowercase Latin letters \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\" and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e\" and question marks \"\u003cspan class\u003d\"tex-font-style-tt\"\u003e?\u003c/span\u003e\".\u003c/p\u003e\u003cp\u003eLet the number of question marks in the string $$$s$$$ be $$$k$$$. Let\u0027s replace each question mark with one of the letters \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\" and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e\". Here we can obtain all $$$3^{k}$$$ possible strings consisting only of letters \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\" and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e\". For example, if $$$s \u003d $$$\"\u003cspan class\u003d\"tex-font-style-tt\"\u003eac?b?c\u003c/span\u003e\" then we can obtain the following strings: $$$[$$$\"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacabac\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacabbc\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacabcc\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacbbac\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacbbbc\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacbbcc\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eaccbac\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eaccbbc\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eaccbcc\u003c/span\u003e\"$$$]$$$.\u003c/p\u003e\u003cp\u003eYour task is to count the total number of subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\" in all resulting strings. Since the answer can be very large, print it modulo $$$10^{9} + 7$$$.\u003c/p\u003e\u003cp\u003eA subsequence of the string $$$t$$$ is such a sequence that can be derived from the string $$$t$$$ after removing some (possibly, zero) number of letters without changing the order of remaining letters. For example, the string \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ebaacbc\u003c/span\u003e\" contains two subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\" — a subsequence consisting of letters at positions $$$(2, 5, 6)$$$ and a subsequence consisting of letters at positions $$$(3, 5, 6)$$$.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of the input contains one integer $$$n$$$ $$$(3 \\le n \\le 200\\,000)$$$ — the length of $$$s$$$.\u003c/p\u003e\u003cp\u003eThe second line of the input contains the string $$$s$$$ of length $$$n$$$ consisting of lowercase Latin letters \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\" and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e\" and question marks\"\u003cspan class\u003d\"tex-font-style-tt\"\u003e?\u003c/span\u003e\".\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint the total number of subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\" in all strings you can obtain if you replace all question marks with letters \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ea\u003c/span\u003e\", \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eb\u003c/span\u003e\" and \"\u003cspan class\u003d\"tex-font-style-tt\"\u003ec\u003c/span\u003e\", modulo $$$10^{9} + 7$$$.\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\u003e6\nac?b?c\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e24\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\u003e7\n???????\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2835\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\u003e9\ncccbbbaaa\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\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\u003e5\na???c\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e46\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\u003eIn the first example, we can obtain $$$9$$$ strings:\u003c/p\u003e\u003cul\u003e \u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacabac\u003c/span\u003e\" — there are $$$2$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\", \u003c/li\u003e\u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacabbc\u003c/span\u003e\" — there are $$$4$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\", \u003c/li\u003e\u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacabcc\u003c/span\u003e\" — there are $$$4$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\", \u003c/li\u003e\u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacbbac\u003c/span\u003e\" — there are $$$2$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\", \u003c/li\u003e\u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacbbbc\u003c/span\u003e\" — there are $$$3$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\", \u003c/li\u003e\u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eacbbcc\u003c/span\u003e\" — there are $$$4$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\", \u003c/li\u003e\u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eaccbac\u003c/span\u003e\" — there is $$$1$$$ subsequence \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\", \u003c/li\u003e\u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eaccbbc\u003c/span\u003e\" — there are $$$2$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\", \u003c/li\u003e\u003cli\u003e \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eaccbcc\u003c/span\u003e\" — there are $$$2$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\". \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eSo, there are $$$2 + 4 + 4 + 2 + 3 + 4 + 1 + 2 + 2 \u003d 24$$$ subsequences \"\u003cspan class\u003d\"tex-font-style-tt\"\u003eabc\u003c/span\u003e\" in total.\u003c/p\u003e"}}]}