#JSUTFPC2025M. Complex Analysis —— 复分析

Complex Analysis —— 复分析

Statement

After Timothy from the Department of Mathematics completed his study of real analysis over R\mathbb{R}, he started to take complex analysis in the next semester.

All prerequisites for complex analysis stem from the extension of the number field, specifically the equation i2=1\mathrm{i}^2=-1. Negative numbers, on the other hand, consist of two parts: a real part aa and an imaginary part bb. In simple terms, a complex number can be represented as a+bia+b\mathrm{i}, where aa and bb are both real numbers. The multiplication on C\mathbb{C} is defined as $(a+b\mathrm{i})(c+d\mathrm{i})=(ac-bd)+(cb+ad)\mathrm{i}$, resulting in a new real part acbdac-bd and an imaginary part cb+adcb+ad.

Given nn complex numbers of the form a+bia+b\mathrm{i}, define the product of these nn complex numbers as x+yix+y\mathrm{i}. Please try to find the values of xx and yy respectively. Since the result may be very large, please output the answer modulo 998244353.

To ensure that the result of the modulo operation remains positive, we redefine the modulo operation as follows: For any integer aa and a non-zero integer mm, there exists a unique pair of integers qq and rr that simultaneously satisfy the following two conditions:

  1. a=q×m+ra=q\times m+r;
  2. 0r<m0\leqslant r < |m|

The result of the modulo operation at this time is denoted as a % m=ra~\% ~m=r, for example, 22 % 30=8,20 % 3=2-22~\% ~30=8, 20~\% ~3=2.

Input

Input a single integer nn in the first line, satisfying 1n2×1051\leqslant n\leqslant 2\times 10^5, representing the number of complex numbers.

In the following nn lines, each line contains two integers ai,bia_i, b_i representing a complex number, where $-1\times 10^9 \leqslant a_i, b_i \leqslant 1\times 10^9$.

Output

Output two non-negative integers representing the values of xx and yy modulo 998244353, respectively.

Samples

3
1 1
4 5
1 4
998244316 5
5
114514 1919810
114 514
1 1
4 5
1 4
699025846 827685096