Rational Dimasik

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

문제

Little Dimasik is a rational numbers fan. He has nn rational numbers x_iy_i\frac{x\_i}{y\_i}. Recently Dimasik learned how to subtract rational numbers.

Recall that every rational number may be expressed in a unique way as an irreducible fraction ab\frac{a}{b}, where aa and bb are coprime integers and b>0b > 0

Let us define the function d(x_iy_i)d \left( \frac{x\_i}{y\_i} \right) as the denominator of the rational number x_iy_i\frac{x\_i}{y\_i} in irreducible notation. For example, d(146)=d(73)=3d(\frac{14}{6}) = d(\frac{7}{3}) = 3.

Now Dimasik wants to calculate the value _1i<jnd(x_iy_ix_jy_j ).\prod\limits\_{1 \le i < j \le n} d \left( \left| \frac{x\_i}{y\_i} - \frac{x\_j}{y\_j}  \right| \right)\text{.} But soon he realized that this problem is too hard for him. Dimasik asks you to help him. As the value may be very large, find it modulo 998,244,353998\\,244\\,353.

입력

The first line contains one integer nn (1n21051 \le n \le 2 \cdot 10^5) denoting the number of rational numbers Dimasik has.

Each of the following nn lines contains two integers x_ix\_i and y_iy\_i (0x_i1090 \le x\_i \le 10^{9}, 1y_i1061 \le y\_i \le 10^6) representing the numerator and denominator of the ii-th rational number.

출력

Print a single integer --- the answer to the problem modulo 998,244,353998\\,244\\,353.