AT_abc477_f [ABC477F] Count Cells in a Window
Description
You are given a grid with $ N $ rows and $ M $ columns. In the $ i $ -th row from the top, the squares from the $ L_i $ -th through $ R_i $ -th columns from the left are painted black, and the other squares are painted white.
You are given $ Q $ queries. For each query, answer the following question.
- You are given integers $ A,B,C,D $ . Find the number of black squares contained in the rectangular region from the $ A $ -th through $ B $ -th rows from the top and from the $ C $ -th through $ D $ -th columns from the left.
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ M $ $ Q $ $ L_1 $ $ R_1 $ $ L_2 $ $ R_2 $ $ \vdots $ $ L_N $ $ R_N $ $ \mathrm{query}_1 $ $ \vdots $ $ \mathrm{query}_Q $
Each query $ \mathrm{query}_i ~ (1 \le i \le Q) $ is given in the form
> $ A $ $ B $ $ C $ $ D $
Output Format
Output $ Q $ lines. The $ i $ -th line should contain the answer to the $ i $ -th query.
Explanation/Hint
### Sample Explanation 1

The black squares are located as shown in the figure above. The $ 1 $ -st query asks for the number of black squares within the blue rectangle at the upper left, the $ 2 $ -nd query within the red rectangle at the lower right, and the $ 3 $ -rd query within the green rectangle at the upper right.
Thus, output $ 4, 3, 0 $ , respectively.
### Constraints
- $ 1 \le N,M,Q \le 2\times10^5 $
- $ 1 \le L_i \le R_i \le M $
- For each query, $ 1 \le A \le B \le N $ .
- For each query, $ 1 \le C \le D \le M $ .
- All input values are integers.