Input
The first line contains the size of the sequence $N$.
The second line contains $A_1, A_2, \ldots, A_N$.
The third line contains the number of queries $M$.
The next $M$ lines each contain a query.
- $1 \le N, M \le 100{,}000$
- $1 \le A_i, y \le 10^9+6$
- $1 \le x \le |A|$
- $1 \le l \le r \le |A|$
- $0 \le z \le |A|$
Output
For queries of type 1 and type 5, output one answer per line in order.
Examples
Input 1
5 1 2 3 2 1 8 1 1 3 5 1 5 2 2 4 1 2 4 3 3 4 0 5 1 1 2 1 1 5
Output 1
6 3 24 0 78
Input 2
10 5 4 3 5 4 1 5 4 3 1 15 2 8 580347 4 6 503576 1 2 5 5 8 11 1 2 6 4 7 565239 3 6 3 11 3 3 2 9 674360 1 1 6 2 2 589693 4 5 236488 1 8 9 5 2 7
Output 2
60 4 107 788510349 0 6