# Psychic Commando - Indicative time limit: 0.5 s (reference environment: [environment and measurements](../../../docs/评测环境与性能.md); for guidance only) - Actual time limit: 2 times the reference solution's baseline runtime on its slowest official test file in the target judging environment, rounded up in 0.5 s increments; if the judge supports only coarser increments, round up again to a supported value. - Memory limit: 128 MB ## Story Yuri plans to airdrop a Psychic Commando team into a training base. The team can control enemy minds, but persuading a radiation meter to stop beeping is outside its job description. Bombardments keep increasing the recorded radiation, while decontamination vehicles lower readings in selected areas. An overenthusiastic cleanup can even produce negative readings. Headquarters has postponed the calibration debate: for now, report the exact sum currently recorded in each candidate area. (This story was rewritten by GPT-6 Astra.) ## Formal Problem Statement The battlefield consists of cells at integer coordinates. Only cells in $[X_{\min},X_{\max}]\times[Y_{\min},Y_{\max}]$ are recorded, initially with value $0$ . Cells outside this region do not participate in updates or queries. The $x$ coordinate increases rightward and $y$ increases downward. ![Integer cell coordinates with x increasing rightward and y downward; each cell is labeled and the origin has a bold outline](assets/coordinates.svg) Figure 1: The coordinates inside a cell identify the whole cell. The bold outline marks the origin $(0,0)$ . Write $(u,v)$ for the coordinates of an arbitrary cell. Process $m$ operations in order: - `0 x_1 y_1 x_2 y_2` : sum the values in the intersection of the closed rectangle $[x_1,x_2]\times[y_1,y_2]$ with the recorded region. An empty intersection has sum $0$ . - `1 x y r p` : bombardment centered at $(x,y)$ . If $r=1$ , only the center cell gains $p$ . If $r\ge2$ , cells satisfying $\lvert u-x\rvert