{"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\"\u003e\u003cstrong\u003eBackground\u003c/strong\u003e\u003cbr\u003eTo The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker.\u003cbr\u003eThe premise of To The Moon is based around a technology that allows us to permanently reconstruct the memory on dying man. In this problem, we\u0027ll give you a chance, to implement the logic behind the scene.\u003cbr\u003e\u003cbr\u003eYou‘ve been given N integers A\u003csub\u003e[1]\u003c/sub\u003e, A\u003csub\u003e[2]\u003c/sub\u003e,..., A\u003csub\u003e[N]\u003c/sub\u003e. On these integers, you need to implement the following operations:\u003cbr\u003e\u003cstrong\u003e1.\u003c/strong\u003e C l r d: Adding a constant d for every {A\u003csub\u003ei\u003c/sub\u003e | l \u0026lt;\u003d i \u0026lt;\u003d r}, and increase the time stamp by 1, this is the only operation that will cause the time stamp increase. \u003cbr\u003e\u003cstrong\u003e2.\u003c/strong\u003e Q l r: Querying the current sum of {A\u003csub\u003ei\u003c/sub\u003e | l \u0026lt;\u003d i \u0026lt;\u003d r}.\u003cbr\u003e\u003cstrong\u003e3.\u003c/strong\u003e H l r t: Querying a history sum of {A\u003csub\u003ei\u003c/sub\u003e | l \u0026lt;\u003d i \u0026lt;\u003d r} in time t.\u003cbr\u003e\u003cstrong\u003e4.\u003c/strong\u003e B t: Back to time t. And once you decide return to a past, you can never be access to a forward edition anymore.\u003cbr\u003e .. N, M ≤ 10\u003csup\u003e5\u003c/sup\u003e, |A\u003csub\u003e[i]\u003c/sub\u003e| ≤ 10\u003csup\u003e9\u003c/sup\u003e, 1 ≤ l ≤ r ≤ N, |d| ≤ 10\u003csup\u003e4\u003c/sup\u003e .. the system start from time 0, and the first modification is in time 1, t ≥ 0, and won\u0027t introduce you to a future state. \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"n m\u003cbr\u003eA\u003csub\u003e1\u003c/sub\u003e A\u003csub\u003e2\u003c/sub\u003e ... A\u003csub\u003en\u003c/sub\u003e\u003cbr\u003e... (here following the m operations. )"}},{"title":"Output","value":{"format":"HTML","content":"... (for each query, simply print the result. )"}},{"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\u003e10 5\r\n1 2 3 4 5 6 7 8 9 10\r\nQ 4 4\r\nQ 1 10\r\nQ 2 4\r\nC 3 6 3\r\nQ 2 4\r\n\r\n2 4\r\n0 0\r\nC 1 1 1\r\nC 2 2 -1\r\nQ 1 2\r\nH 1 2 1\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n55\r\n9\r\n15\r\n\r\n0\r\n1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}