Problem Description
Firdavs started studying data structures, in particular those that allow performing operations on segments and answering queries about the value of an element at a given position. To make it more interesting for Firdavs, Khaled complicated the task by adding a query to swap two elements at different positions. Firdavs was able to solve this problem --- can you?
You are given numbers , , and an array of size . Write a program that processes operations of the following types:
- --- output the value of the element at position ;
- --- swap the values of the elements at positions and ;
- --- increase by all elements in the segment from to inclusive.
Input
In the first line, there are two integers and .
In the second line, the elements of the array are written .
In the next lines, the operations are given in the following format:
- --- query for the value of the element at position ;
- --- swap the values of the elements at positions and ;
Output
For each query of type , output the value of the element at position on a separate line.
Scoring System
| Group | Additional constraints | Points | Required subtasks |
|---|---|---|---|
| 0 | Tests from examples | 0 | — |
| 1 | Only operations of type | 7 | — |
| 2 | Only operations of type | 29 | — |
Examples
Example 1
Input
2 5 26 26 3 1 2 1999 3 1 1 1 2 1 2 1 1 1 2
Output
2025 2026