In the Lemon Kingdom, there are cities and roads. The -th road is a bidirectional road connecting city and city . Here, , and there may be multiple roads between two cities. However, currently, all roads are too obsolete and cannot be used.
The engineer Jaewon wants to maintain and reactivate some of these roads. However, King Damyoo XVIII of the Lemon Kingdom wants the shape of the cities to be circular. In other words, when interpreting the kingdom as an undirected graph with vertices, each connected component must satisfy one of the following conditions.
- The degree of all vertices in the component is . That is, it is a simple cycle.
- The size of the component is . That is, it is an isolated vertex.
Jaewon must follow Damyoo's orders, and to save costs, he plans to select and activate only consecutively numbered roads. That is, he chooses an integer pair and activates only the roads from the -th road to the -th road.
However, since testing all cases manually is too costly, he asked the informatics expert Woohyun for a simulation. For the -th query, two integers, and are given. Woohyun needs to find the number of pairs satisfying that meet the conditions.
Become Woohyun and find the answer to each query.
Input
The input is given in the following format.
Output
From the first line, print the answer to each query, one per line over lines.
Constraints
- .
- .
- .
- ().
- ().