{"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\u003eMathematicians are interesting (sometimes, I would say, even crazy) people. For example, my friend, a mathematician, thinks that it is very fun to play with a sequence of integer numbers. He writes the sequence in a row. If he wants he increases one number of the sequence, sometimes it is more interesting to decrease it (do you know why?..) And he likes to add the numbers in the interval \u003cspan class\u003d\"tex-span\"\u003e[\u003ci\u003el\u003c/i\u003e;\u003ci\u003er\u003c/i\u003e]\u003c/span\u003e. But showing that he is really cool he adds only numbers which are equal some \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003emod\u003c/i\u003e\u003c/span\u003e (modulo \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003em\u003c/i\u003e\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eGuess what he asked me, when he knew that I am a programmer? Yep, indeed, he asked me to write a program which could process these queries (\u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e is the length of the sequence): \u003c/p\u003e\u003cul\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e+ p r\u003c/span\u003e It increases the number with index \u003cspan class\u003d\"tex-font-style-tt\"\u003ep\u003c/span\u003e by \u003cspan class\u003d\"tex-font-style-tt\"\u003er\u003c/span\u003e. (\u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/6f125ff9c30b804ada00333d3f0c79b4?v\u003d1726343462\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e, \u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/6e176ebe1091d2e3d7368da57344692a?v\u003d1726343462\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e)\u003cp\u003eYou have to output the number after the increase.\u003c/p\u003e\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003e- p r\u003c/span\u003e It decreases the number with index \u003cspan class\u003d\"tex-font-style-tt\"\u003ep\u003c/span\u003e by \u003cspan class\u003d\"tex-font-style-tt\"\u003er\u003c/span\u003e. (\u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/6f125ff9c30b804ada00333d3f0c79b4?v\u003d1726343462\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e, \u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/6e176ebe1091d2e3d7368da57344692a?v\u003d1726343462\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e) You must not decrease the number if it would become negative.\u003cp\u003eYou have to output the number after the decrease.\u003c/p\u003e\u003c/li\u003e\u003cli\u003e \u003cspan class\u003d\"tex-font-style-tt\"\u003es l r mod\u003c/span\u003e You have to output the sum of numbers in the interval \u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/28fcdc4a5b3c172119524f9a378afe12?v\u003d1726343462\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e which are equal \u003cspan class\u003d\"tex-font-style-tt\"\u003emod\u003c/span\u003e (modulo \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003em\u003c/i\u003e\u003c/span\u003e). (\u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/dc757196c66e1305ffdb7ef1839bfba4?v\u003d1726343462\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e) (\u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/ed8778daaeb07011bd157c099148919e?v\u003d1726343462\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e) \u003c/li\u003e\u003c/ul\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line of each test case contains the number of elements of the sequence \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e and the number \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003em\u003c/i\u003e\u003c/span\u003e. (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003en\u003c/i\u003e ≤ 10000\u003c/span\u003e) (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003em\u003c/i\u003e ≤ 10\u003c/span\u003e)\u003c/p\u003e\u003cp\u003eThe second line contains \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e initial numbers of the sequence. (\u003cspan class\u003d\"tex-span\"\u003e0 ≤ \u003ci\u003enumber\u003c/i\u003e ≤ 1000000000\u003c/span\u003e)\u003c/p\u003e\u003cp\u003eThe third line of each test case contains the number of queries \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eq\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e1 ≤ \u003ci\u003eq\u003c/i\u003e ≤ 10000\u003c/span\u003e).\u003c/p\u003e\u003cp\u003eThe following \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eq\u003c/i\u003e\u003c/span\u003e lines contains the queries (one query per line).\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003eOutput \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eq\u003c/i\u003e\u003c/span\u003e lines - the answers to the queries.\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\u003e3 4\n1 2 3\n3\ns 1 3 2\n+ 2 1\n- 1 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n3\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}