{"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":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e\n Little 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$.\n \u003cbr\u003e\n However, 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.\n \u003cbr\u003e\n For 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$.\n \u003cbr\u003e\n Little Q now has a long numeric 1-based string $S$, and his job is to deal with $m$ operations:\n \u003cbr\u003e\n \u003cbr\u003e\n 1. + $l$ $r$ $k$, for every positions from $l$ to $r$, change $S_i$ to $(S_i+k)\\bmod 10$.\n \u003cbr\u003e\n 2. ? $l$ $r$ $T$, report $occ(T,S[l,r])$.\n \u003cbr\u003e\n \u003cbr\u003e\n After lots of work, Little Q is very tired now, please write a program to help him deal with these operations.\n\u003c/div\u003e\n\u003cbr\u003e\n小Q现在正在检查字符串A是否与B匹配,如果两个字符串长度相同,并且每个位置上的字符都相同,则两个字符串匹配。\n\u003cbr\u003e\n但是,如果Ai和Bi不相同的字符不超过3个,那么小Q也会认为这两个字符串是匹配的。\n对于字符串S, S[l,r]表示由$S_l, S_{l+1}, ..., S_r$组合的子字符串。函数occ(A,B)返回字符串B中与A匹配的子字符串的个数。\n\u003cbr\u003e\n小Q现在有一个基于1的长数字字符串S,他的工作是处理以下m个操作:\u003cbr\u003e\n1. + l r k,对于从1到r的每个位置,将$S_i$ to $(S_i+k)\\bmod 10$。\u003cbr\u003e\n2. ? l r T,返回$occ(T,S[l,r])$。\u003cbr\u003e\n经过大量的工作,小Q现在很累了,请写一个程序帮他处理这些操作。"}},{"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.\n\u003cbr\u003e\nIn 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.\n\u003cbr\u003e\nThe 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.\n\u003cbr\u003e\nIn the following $m$ lines, each line describes an operation.\n\u003cbr\u003e\nIf 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$.\n\u003cbr\u003e\nIf 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.\n\u003cbr\u003e\nIt 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$.\n\u003cbr\u003e\n输入的第一行包含一个整数T(1≤T≤15),表示测试用例的数量。\u003cbr\u003e\n在每个测试用例中,第一行有两个整数n(1≤n≤50000)和m(1≤m≤50000),分别表示字符串S的长度和操作次数。\u003cbr\u003e\n输入的第二行包含一个包含n个整数的数字字符串S,每个Si的取值范围是0到9。\u003cbr\u003e\n在接下来的m行中,每行描述一个操作。\u003cbr\u003e\n如果是修改,则格式为“+ l r k”,其中1≤l≤r≤n, 1≤k≤9。\u003cbr\u003e\n如果是查询,则格式为“? l r T”,其中1≤l≤r≤n, T是由0 ~ 9的整数组成的数字字符串。\u003cbr\u003e\n保证每个测试用例∑|T|≤100000,满足min(n,m)\u003e1000的测试用例不超过4个。"}},{"title":"Output","value":{"format":"HTML","content":"For each query, print a single line with an integer, denoting the answer.\n\u003cbr\u003e\n对于每个查询,打印带有整数的单行,表示答案。"}},{"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\n5 5\n01234\n? 2 5 1234\n? 2 5 1777\n? 2 5 9999\n+ 1 5 5\n? 1 5 56789\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n1\n0\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}