Given a matrix of size N \times N, where each element is either or . In every row, the elements that are are contiguous.
Your task is to calculate the determinant of this matrix.
The first line of the input contains an integer (1 \leq N \leq 10^6) representing the size of the matrix. The next lines each contain two integers l_i and r_i (1 \leq l_i \leq r_i \leq N), which specify that in the -th row, the elements from position l_i to r_i (inclusive) are ones, while all other elements are zeros.
Print a single integer, which is the determinant of the matrix.
Example 1