There are $n$ students lined up in a row, where the $i$-th student from the left holds a sign with the number $a_i$. The numbers on the signs are distinct integers between $1$ and $n$.
They are rehearsing an activity called "Comparison", which consists of $n - 1$ rounds. In each round, the two students currently at the far left of the line step forward and compare the numbers on their signs. The student with the larger number is selected (and does not return to the line or participate in subsequent rounds), while the student with the smaller number returns to the far right of the line.
You need to process $m$ operations of two types:
- Swap the signs held by the students at positions $x$ and $y$ from the left ($1 \le x < y \le n$);
- Given $l$ and $r$ ($1 \le l \le r < n$), simulate the activity with the current line of students and calculate the sum of the numbers on the signs of the students selected from the $l$-th round to the $r$-th round, inclusive (after the simulation, the students return to their positions prior to this query).
Input
The first line contains two integers $n$ and $m$ ($2 \le n \le 10^5, 1 \le m \le 10^5$), representing the number of students and the number of operations, respectively.
The second line contains $n$ distinct integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le n$), representing the numbers initially on the signs held by the students from left to right.
Each of the next $m$ lines describes an operation in one of the following two formats:
C x y($1 \le x < y \le n$): swap the signs held by the students at positions $x$ and $y$ from the left;A l r($1 \le l \le r < n$): query the sum of the numbers on the signs of the students selected from the $l$-th round to the $r$-th round if the activity is simulated with the current line.
Output
For each A l r operation, output a single line containing an integer representing the answer.
Example
Input
5 6 4 3 1 2 5 A 3 4 C 1 2 A 3 4 A 2 4 C 3 5 A 1 3
Output
8 8 10 12
Note
For the first query, the signs from left to right are $[4, 3, 1, 2, 5]$. The numbers selected in the four rounds are $4, 2, 5, 3$, so the sum from the $3$-rd round to the $4$-th round is $5 + 3 = 8$.
For the last query, the signs from left to right are $[3, 4, 5, 2, 1]$. The numbers selected in the four rounds are $4, 5, 3, 2$, so the sum from the $1$-st round to the $3$-rd round is $4 + 5 + 3 = 12$.