The first line contains two integer(
), denoting the length of the array
and the number of queries.
The second line containsintegers
(
).
Each of the following blocks of lines contains the description of one query.
For each query, the first line contains an integer, denotes the number of segments. The following
lines contains two integers
(
), representing the
segments in the query.
It guaranteed that,
.
For each query, output a number in a line indicating the answer.