#P7556. [2018年杭电多校]Absolute
[2018年杭电多校]Absolute
Absolute
Problem Description
Winter is here at the North and the White Walkers are close. There's a young Night Watch standing on the Wall. The young Night Watch has created a method to keep his body warm. Every time he generate a random rational number x in range independently and uniformly, then he walks x meters to east. Now he has n ranges , He wants to know the expected distance to origin. If answer is a fraction , output an integer so that .
Input
An integer n in the first line. The following n lines, each contain two integers .
Output
Output the expected distance to origin in a line, modulo 998244353.
Sample Input
2
-2 3
-2 1
Sample Output
199648872
Source
2018 Multi-University Training Contest 2