The first line contains the number of queries M (1≤M≤500,000).
Each of the next M lines contains one query. In queries of type 1, 2 and 4, the value x satisfies 1≤x≤500,000.
Let N be the length of A right before a query runs. Queries of type 2, 4 and 5 satisfy 1≤L≤R≤N, and a query of type 3 satisfies 1≤k≤N. A query of type 5 also satisfies k≤R−L+1.