Interval

아직 제출이 없습니다시간 제한4초메모리 제한512 MB

문제

You are given nn intervals, the jj-th of which is I_j=\[l_j,r_j]I\_j = \[l\_j, r\_j].

Define the beauty of \[L,R]\[L, R] as the length covered by _i=LR\[l_i,r_i]\displaystyle \bigcup\limits\_{i = L}^R \[l\_i, r\_i].

You are given mm queries, the ii-th of which is \[A_i,B_i]\[A\_i, B\_i], and you need to answer:

If we uniformly sample \[L_i,R_i]\[L\_i, R\_i] from all possible integer pairs such that A_iL_iR_iB_iA\_i \le L\_i \le R\_i \le B\_i, what is the expected value of the beauty of \[L_i,R_i]\[L\_i, R\_i]?

Find the answers modulo 998,244,353998\\,244\\,353.

입력

The first line contains two integers nn and mm (1n,m21051 \le n, m \le 2 \cdot 10^5).

Each of the following nn lines contains two integers l_jl\_j and r_jr\_j (0l_j<r_j1080 \le l\_j < r\_j \le 10^8).

Each of the following mm lines contains two integers A_iA\_i and B_iB\_i (1A_iB_in1 \le A\_i \le B\_i \le n).

출력

Output mm lines, each of which contains the answer for a query modulo 998,244,353998\\,244\\,353.

Formally, it can be shown that the expected beauty can be represented as a fraction p/qp / q for some coprime non-negative integers pp and qq. You have to print the value pq1mod998,244,353p \cdot q^{-1} \bmod 998\\,244\\,353.

힌트

The size of input and output is large. Remember to use fast input and output methods to avoid getting a "Time Limit Exceeded".