8640: DSL_2_E : Range Add Query (RAQ)
[Creator : ]
Description
Write a program which manipulates a sequence A = {$a_1,a_2,...,a_n$} with the following operations:
- add(s,t,x): add x to $a_s, a_{s+1}, ..., a_t$.
- get(i): output the value of $a_i$.
Note that the initial values of $a_i\ (i=1,2,...,n)$ are 0.
Input
In the first line, n (the number of elements in A) and q (the number of queries) are given. Then, ith query queryi is given in the following format:
0 s t x
or
1 t
The first digit represents the type of the query. '0' denotes add(s,t,x) and '1' denotes get(i).
Output
For each get operation, print the value.
Constraints
1≤n≤100,000
1≤q≤100,000
1≤s≤t≤n
1≤i≤n
0≤x≤1,000
1≤q≤100,000
1≤s≤t≤n
1≤i≤n
0≤x≤1,000
Sample 1 Input
3 5
0 1 2 1
0 2 3 2
0 3 3 3
1 2
1 3
Sample 1 Output
3
5
Sample 2 Input
4 3
1 2
0 1 4 1
1 2
Sample 2 Output
0
1