
On a cool evening, Mr. 01011 wanted to take a bath in his tank filled with a liquid of density . However, the liquid was too cold for bathing. To make the most of his time in the magical tank, which is divided into compartments with varying densities, Mr. 01011 decided to conduct experiments with floating bodies in the tank. The temperature of the liquids in the tank does not affect these bodies. Each body is a regular cube with a specific density and edge length, equipped with a device that can instantly adjust its volume. When placed in a tank, part of the body will be submerged, and you need to determine the volume of this submerged part.
Each experiment involves the following actions:
Place the body in a specific tank (INS)
Remove the body from a specific tank (DEL)
Attach a body of the same density with volume to a specific body in a tank (INC)
Cut off a part of a specific body in a tank with volume (DEC)
Calculate the total submerged volume of bodies in tanks from to , and return the sum of all submerged volumes (CALC)
All processes occur at constant temperature and pressure.
The input begins with an integer (N \leq 10^5), representing the number of tanks. The next lines provide the density of the liquid in each tank \rho_i in kg/m³ (1 \leq \rho_i \leq 20000, real number). The following line contains the integer (Q \leq 10^5), the number of experiments. Each of the next lines contains one of the following formats:
INS X Y Z — where is the tank number (integer), is the density of the body (1 \leq Y \leq 20000, real number, in kg/m³), and is the edge length of the cube (1 \leq Z \leq 1000, real number, in meters).
DEL X — where (integer) is the serial number of the cube to be removed. Ignore this command if the cube hasn't been placed in any tank.
INC X Y — where (integer) is the serial number of the cube to increase in volume, and (1 \leq Y \leq 10^9, real number, in m³) is the volume increase. Ignore this command if the cube hasn't been placed in a tank or has been removed.
DEC X Y — where (integer) is the serial number of the cube to decrease in volume, and (1 \leq Y \leq 10^9, real number, in m³) is the volume decrease. Ignore this command if the cube hasn't been placed in a tank or has been removed. If the body has less volume than , consider it as having zero mass and volume.
CALC L R — where , (1 \leq L, R \leq N) are integers. Calculate the total submerged volume of bodies in tanks numbered from to .
Each tank can accommodate the liquid without overflowing when bodies are submerged. Bodies are assigned serial numbers starting from in the order they appear in INS queries.
After each query, output the result of the query CALC 1 N on a new line. Additionally, after each CALC query, output the result of that query on a new line. For example, if a CALC L R query is received, first provide the answer to CALC 1 N, and then on a new line, the answer to CALC L R.
Ensure the answers to the queries are output with a precision of at least decimal places.
Example Explanation: We have tanks with a density of . There are queries to process.
INS 1 800 2 — Execute this query and display the result of CALC 1 5.
INC 1 4 — Execute this query and display the result of CALC 1 5.
DEL 2 — Execute this query and display the result of CALC 1 5.
INS 3 1200 5 — Execute this query and display the result of CALC 1 5.
INS 4 300 10 — Execute this query and display the result of CALC 1 5.
DEC 2 25 — Execute this query and display the result of CALC 1 5.
CALC 1 3 — Display the result of CALC 1 5 and then execute this query.
INC 3 500 — Execute this query and display the result of CALC 1 5.
CALC 3 4 — Display the result of CALC 1 5 and then execute this query.
DEL 1 — Execute this query and display the result of CALC 1 5.
Example 1