Range Updates


You are given an array of nn integers and must process qq queries of the following types:

  1. Increase every value in the range [l,r][l, r] by uu.
  2. Report the value at position kk.

Positions are 1-indexed.

Input

The first line contains the integer nn.

The second line contains nn integers x1,,xnx_1, \ldots, x_n: the initial values of the array.

The third line contains the integer qq.

Each of the next qq lines describes a query and is one of the following:

  • 1 l r u: add uu to every value in the range [l,r][l, r]
  • 2 k: query the value at position kk

Output

For each query of type 2, output a line containing the value at position kk.

Constraints

  • 1n1051 \le n \le 10^5
  • 1q1051 \le q \le 10^5
  • 1xi,u1091 \le x_i, u \le 10^9
  • 1kn1 \le k \le n
  • 1lrn1 \le l \le r \le n

Example 1

Input 1
5
8 8 6 7 9 
10
1 1 4 3
1 4 5 9
1 1 4 1
2 4
2 3
2 3
2 2
1 1 2 9
1 4 5 1
2 5
Output 1
20
10
10
12
19

Hints

Hint 1

Try converting this from a range-update / point-query problem into a point-update / range-query problem.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.