#P6327. 区间加区间 sin 和

区间加区间 sin 和

Description

Given an integer sequence a1,a2,,ana_1,a_2,\ldots,a_n of length nn, perform mm operations. There are two types of operations.

Operation 11: given l,r,vl,r,v, add vv to each of al,al+1,,ara_l,a_{l+1},\ldots,a_r.

Operation 22: given l,rl,r, query i=lrsin(ai)\sum\limits_{i=l}^{r}\sin(a_i).

Input Format

The first line contains an integer nn.

The next line contains nn integers representing a1,a2,,ana_1,a_2,\ldots,a_n.

The next line contains an integer mm.

The next mm lines each describe an operation. Operation 11 is written as 1 l r v, and operation 22 is written as 2 l r.

Output Format

For each operation 22, output one line with the answer, rounded to one decimal place.

It is guaranteed that the absolute value of the answer is greater than 0.10.1, and that the second digit after the decimal point of the exact answer is not 44 or 55.

5
1 3 1 5 5
5
1 5 5 5
2 3 3
2 1 5
2 2 2
2 4 4
0.8
0.3
0.1
-1.0

Hint

Idea: nzhtl1477, Solution: nzhtl1477, Code: ccz181078, Data: nzhtl1477.

Constraints: 1n,m,ai,v2×1051\leq n,m,a_i,v\leq 2\times 10^5, 1lrn1\leq l\leq r\leq n. It is guaranteed that all input numbers are positive integers.

Translated by ChatGPT 5