{"trustable":true,"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":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eLittle Q is now checking whether string $A$ matches $B$. Two strings are considered matched if they have the same length, and there are no position $i$ that $A_i$ is different from $B_i$.\u003cbr\u003eHowever, Little Q is a kind man, he forgives every person hurt him. What\u0027s more, he even forgives strings! He gives the string 3 opportunities, if there are no more than 3 positions $i$ that $A_i$ is different from $B_i$, then Little Q will also consider the two strings matched.\u003cbr\u003eFor a string $S$, $S[l,r]$ means the substring combined by $S_l, S_{l+1}, ..., S_r$. And the function $occ(A,B)$ returns the number of substrings in string $B$ which matches $A$.\u003cbr\u003eLittle Q now has a long numeric 1-based string $S$, and his job is to deal with $m$ operations:\u003cbr\u003e\u003cbr\u003e 1. + $l$ $r$ $k$, for every positions from $l$ to $r$, change $S_i$ to $(S_i+k)\\bmod 10$.\u003cbr\u003e 2. ? $l$ $r$ $T$, report $occ(T,S[l,r])$.\u003cbr\u003e\u003cbr\u003eAfter lots of work, Little Q is very tired now, please write a program to help him deal with these operations.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains an integer $T(1\\leq T\\leq15)$, denoting the number of test cases.\u003cbr\u003eIn each test case, there are two integers $n(1\\leq n\\leq 50000)$ and $m(1\\leq m\\leq 50000)$ in the first line, denoting the length of string $S$ and the number of operations.\u003cbr\u003eThe second line of the input contains a numeric string $S$ with $n$ integers, each number $S_i$ is in the range of 0 to 9.\u003cbr\u003eIn the following $m$ lines, each line describes an operation.\u003cbr\u003eIf it is a modification, then it is in the format of \u0027\u0027+ $l$ $r$ $k$\u0027\u0027, where $1\\leq l\\leq r\\leq n$ and $1\\leq k\\leq 9$.\u003cbr\u003eIf it is a query, then it is in the format of \u0027\u0027? $l$ $r$ $T$\u0027\u0027, where $1\\leq l\\leq r\\leq n$ and $T$ is a numeric string composed of integers from 0 to 9.\u003cbr\u003eIt is guaranteed that $\\sum|T|\\leq 100000$ in each test case, and there are no more than $4$ test cases satisfying $\\min(n,m)\u0026gt;1000$."}},{"title":"Output","value":{"format":"HTML","content":"For each query, print a single line with an integer, denoting the answer."}},{"title":"Sample","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\u003e1\r\n5 5\r\n01234\r\n? 2 5 1234\r\n? 2 5 1777\r\n? 2 5 9999\r\n+ 1 5 5\r\n? 1 5 56789\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n1\r\n0\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}