Little Gyro and Array
题号:NC200115
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Little Gyro has just found an integer array A = { a_1, a_2,..., a_n } in his left pocket, As Little Gyro is bored, he decides to play with the array.
Then, Little Gyro is about to do the following two operations:
1. 1 L R K D : Given an arithmetic sequence with its length R-L+1, the first item of this sequence is K, and its tolerances is D, then Little Gyro will add this sequence to of array A within the corresponding position. For example: , , ,……, .
2. 2 P : Query the value of the P-th number a_p of the array A.
Given an integer array A with its length n, after m operations, for each query, Little Gyro wants to know the value of the array elements and ask you for help, please help him to calculate the answer.

输入描述:

Each input file only contains one test case.
The first line contains two integers n, m (1 ≤ n, m ≤ ), indicating the length of the array and the number of the operations.
The second line contains n integers a_1,a_2,...,a_n ( ≤ 200), indicating the given array.
In the following m lines, each line contains one operation, within the following two formats which described above:
1 L R K D (| K | ≤ 200, | D | ≤ 200, 1 ≤ L ≤ R ≤ n)
2 P (1 ≤ P ≤ n)

输出描述:

For each query output an integer indicating the value of a_p from the current array A.
示例1

输入

复制
5 2
1 2 3 4 5
1 2 4 1 2
2 3

输出

复制
6