#SGM0000031. Bật tắt đèn (Light Switching)

Bật tắt đèn (Light Switching)

Light Switching

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn lights, initially off. Support range toggles and range counts of lights that are on.

Input

The first line contains n,mn,m. Each of the next mm lines is op l r.

  • 0 l r: toggle every light from ll through rr.
  • 1 l r: count the lights that are on in that range.

Output

Print one line for every type 1 query.

Subtasks

  • 20 points: 2≤n≤502\le n\le50, m≤50m\le50.
  • 30 points: n,m≤5000n,m\le5000.
  • 50 points: 2≤n≤1052\le n\le10^5, 1≤m≤1051\le m\le10^5, 1≤l≤r≤n1\le l\le r\le n.

Examples

Input

4 5
0 1 2
0 2 4
1 2 3
0 2 4
1 1 4

Output

1
2

Explanation

After the first two toggles the state is 1 0 1 1, so range [2,3][2,3] contains one on light. Toggling [2,4][2,4] again gives 1 1 0 0, hence two lights are on.