Array#5301

Array

1 second
128 megabytes
Very easy

Consider an array that initially contains numbers. The elements of the array are numbered from left to right, starting from . The following operations can be performed on this array:

You are to perform all described operations in the given order.

Input

The first line contains two integers and (1 \le n,\ m \le 100\ 000), where is the number of queries. The second line contains integers: the initial elements of the array before any operations. The next lines describe the operations to perform. Each operation is specified by its type followed by its parameters, separated by spaces. It is guaranteed that during the operations, the array is never empty. All indices used in operations are from to the current array size, except for the operation I 0 x, which corresponds to insertion at the beginning. All input numbers are between and 10^9 inclusive.

Output

For each A query, output the answer to that query on a separate line. In addition, after all operations output the resulting array.

Examples

Example 1

Loading
Loading