Signs alternation#3503

Signs alternation

1 second
122.174 megabytes
Very easy

Implement a data structure with elements a_1, a_2, \ldots, a_n that supports the following operations:

Input

The first line contains a positive integer (1 \leq n \leq 10^5) — the length of the array. The second line contains the initial values of the elements — non-negative integers, each not greater than 10^4.

The third line contains a positive integer (1 \leq m \leq 10^5) — the number of operations. The following lines describe the operations:

  • an operation of the first type is given by three numbers (1 \leq i \leq n,\ 1 \leq j \leq 10^4);

  • an operation of the second type is given by three numbers (1 \leq l \leq r \leq n).

Output

For each operation of the second type, print the corresponding alternating sum in a separate line.

Examples

Example 1

Loading
Loading