#JSUTFPC2025M. Complex Analysis —— 复分析
Complex Analysis —— 复分析
Statement
After Timothy from the Department of Mathematics completed his study of real analysis over , 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 . Negative numbers, on the other hand, consist of two parts: a real part and an imaginary part . In simple terms, a complex number can be represented as , where and are both real numbers. The multiplication on is defined as $(a+b\mathrm{i})(c+d\mathrm{i})=(ac-bd)+(cb+ad)\mathrm{i}$, resulting in a new real part and an imaginary part .
Given complex numbers of the form , define the product of these complex numbers as . Please try to find the values of and 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 and a non-zero integer , there exists a unique pair of integers and that simultaneously satisfy the following two conditions:
- ;
The result of the modulo operation at this time is denoted as , for example, .
Input
Input a single integer in the first line, satisfying , representing the number of complex numbers.
In the following lines, each line contains two integers 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 and 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