#agc047c. [agc047_c]Product Modulo

[agc047_c]Product Modulo

Problem Statement

Let’s take a prime P=200,003P = 200\\,003. You are given NN integers A1,A2,ldots,ANA_1, A_2, \\ldots, A_N. Find the sum of ((AicdotAj)bmodP)((A_i \\cdot A_j) \\bmod P) over all Ncdot(N1)/2N \\cdot (N-1) / 2 unordered pairs of elements (i<ji < j).

Please note that the sum isn't computed modulo PP.

Constraints

  • 2leqNleq200,0002 \\leq N \\leq 200\\,000
  • 0leqAi<P=200,0030 \\leq A_i < P = 200\\,003
  • All values in input are integers.

Input

Input is given from Standard Input in the following format.

NN A1A_1 A2A_2 cdots\\cdots ANA_N

Output

Print one integer — the sum over ((AicdotAj)bmodP)((A_i \\cdot A_j) \\bmod P).


Sample Input 1

4
2019 0 2020 200002

Sample Output 1

474287

The non-zero products are:

  • 2019cdot2020bmodP=783202019 \\cdot 2020 \\bmod P = 78320
  • 2019cdot200002bmodP=1979842019 \\cdot 200002 \\bmod P = 197984
  • 2020cdot200002bmodP=1979832020 \\cdot 200002 \\bmod P = 197983

So the answer is 0+78320+197984+0+0+197983=4742870 + 78320 + 197984 + 0 + 0 + 197983 = 474287.


Sample Input 2

5
1 1 2 2 100000

Sample Output 2

600013