CF461C Appleman and a Sheet of Paper

Description

Appleman has a very big sheet of paper. This sheet has a form of rectangle with dimensions $ 1×n $ . Your task is help Appleman with folding of such a sheet. Actually, you need to perform $ q $ queries. Each query will have one of the following types: 1. Fold the sheet of paper at position $ p_{i} $ . After this query the leftmost part of the paper with dimensions $ 1×p_{i} $ must be above the rightmost part of the paper with dimensions $ 1×([current width of sheet]-p_{i}) $ . 2. Count what is the total width of the paper pieces, if we will make two described later cuts and consider only the pieces between the cuts. We will make one cut at distance $ l_{i} $ from the left border of the current sheet of paper and the other at distance $ r_{i} $ from the left border of the current sheet of paper. Please look at the explanation of the first test example for better understanding of the problem.

Input Format

The first line contains two integers: $ n $ and $ q $ ( $ 1

Output Format

For each query of the second type, output the answer.

Explanation/Hint

The pictures below show the shapes of the paper during the queries of the first example: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF461C/0d6f18a0c20d16406159d704035cbac205902978.png)After the first fold operation the sheet has width equal to $ 4 $ , after the second one the width of the sheet equals to $ 2 $ .