{"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\"\u003eRecently, A country, the archenemy of C country, has been conducting military exercises, so the head of C country\u0027s spy, Derek, and his subordinate Tidy have become busy again. A country has deployed N military camps along the coastline in a straight line. Derek and Tidy\u0027s task is to monitor the activities of these military camps. Due to the use of some advanced monitoring methods, C country is well aware of the number of personnel at each military camp. The number of personnel at each military camp may change, either increasing or decreasing, but C country\u0027s surveillance is always vigilant. \u003cbr\u003e The Central Intelligence Agency wants to study what tactics the enemy is exercising, so Tidy must report to Derek at any time the total number of personnel in a certain continuous range of military camps. For example, if Derek asks, \"Tidy, immediately report the total number of personnel from the 3rd camp to the 10th camp!\" Tidy must immediately start calculating the total number of personnel in this range and report it. However, the number of enemy camp personnel often changes, and each time Derek inquires about a different range, so Tidy has to count each camp one by one, quickly becoming exhausted. Derek becomes increasingly dissatisfied with Tidy\u0027s calculation speed, saying, \"You slow fatso, you calculate so slowly, I\u0027ll fire you!\" Tidy thinks to himself, \"You try calculating it yourself, this is really a tiring job! I wish you would fire me!\" Helpless, Tidy has to call the computer expert Windbreaker for help. Windbreaker says, \"Slow fatso, if only you had done more ACM problems and read more algorithm books, now you would not be suffering, right?\" Tidy says, \"I know I was wrong...\" but Windbreaker has already hung up. Tidy is very distressed; he will really collapse if he continues to calculate like this. Smart readers, can you write a program to help him complete this task? However, if your program\u0027s efficiency is not high enough, Tidy will still be scolded by Derek. \u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains an integer T, indicating the number of test cases. \u003cbr\u003e For each test case, the first line contains a positive integer N (N\u0026lt;\u003d50000), indicating that there are N military camps, followed by N positive integers. The i-th positive integer ai represents the initial number of personnel in the i-th military camp (1\u0026lt;\u003dai\u0026lt;\u003d50). \u003cbr\u003e Then, each line contains a command, which can take one of four forms: \u003cbr\u003e (1) Add i j, where i and j are positive integers, indicating that the number of personnel in the i-th camp is to be increased by j (where j does not exceed 30). \u003cbr\u003e (2) Sub i j, where i and j are positive integers, indicating that the number of personnel in the i-th camp is to be decreased by j (where j does not exceed 30). \u003cbr\u003e (3) Query i j, where i and j are positive integers and i\u0026lt;\u003dj, indicating an inquiry about the total number of personnel from the i-th to the j-th camp. \u003cbr\u003e (4) End, indicating the end of each test case. There are at most 40000 commands for each test case. \u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For the i-th test case, first output \"Case i:\" followed by a line break. \u003cbr\u003e For each Query inquiry, output an integer followed by a line break, representing the total number of personnel in the specified range, which will fit within an int. \u003cbr\u003e"}},{"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\n10\r\n1 2 3 4 5 6 7 8 9 10\r\nQuery 1 3\r\nAdd 3 6\r\nQuery 2 7\r\nSub 10 2\r\nAdd 6 3\r\nQuery 3 10\r\nEnd \r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase 1:\r\n6\r\n33\r\n59\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}