Problem: Let’s take a prime P = 200\,003. You are given N integers A_1, A_2, \ldots, A_N. Find the sum of ((A_i \cdot A_j) \bmod P) over all N \cdot (N-1) / 2 unordered pairs of elements (i < j).

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

Constraints

* 2 \leq N \leq 200\,000
* 0 \leq A_i < P = 200\,003
* All values in input are integers.

Input

Input is given from Standard Input in the following format.


N
A_1 A_2 \cdots A_N


Output

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

Examples

Input

4
2019 0 2020 200002


Output

474287


Input

5
1 1 2 2 100000


Output

600013

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;


#define int long long 


const int mod = 2e5 + 3;

int POW(int a, int b, int mod) {
	a %= mod; int r = 1;
	for(int i = b; i > 0; i >>= 1) {
		if(i & 1) r = (r * a) % mod;
		a = (a * a) % mod;
	}
	return r;
}

int generator(int p) {
	int phi = p - 1, n = phi;
	vector <int> f;
	for(int i = 2; i * i <= n; i++) {
		if(n % i == 0) {
			f.push_back(i);
			while(n % i == 0) {
				n /= i;
			}
		}
	}
	if(n > 1) {
		f.push_back(n);
	}
	for(int i = 2; i < p; i++) {
		int flag = true;
		for(int d: f) {
			flag &= POW(i, phi / d, p) != 1;
		}
		if(flag) {
			return i;
		}
	}
	return -1;
}


using cd = complex<double>;
const double PI = acos(-1);

int reverse(int num, int lg_n) {
    int res = 0;
    for (int i = 0; i < lg_n; i++) {
        if (num & (1 << i))
            res |= 1 << (lg_n - 1 - i);
    }
    return res;
}

void fft(vector<cd> & a, bool invert) {
    int n = a.size();
    int lg_n = 0;
    while ((1 << lg_n) < n)
        lg_n++;

    for (int i = 0; i < n; i++) {
        if (i < reverse(i, lg_n))
            swap(a[i], a[reverse(i, lg_n)]);
    }

    for (int len = 2; len <= n; len <<= 1) {
        double ang = 2 * PI / len * (invert ? -1 : 1);
        cd wlen(cos(ang), sin(ang));
        for (int i = 0; i < n; i += len) {
            cd w(1);
            for (int j = 0; j < len / 2; j++) {
                cd u = a[i+j], v = a[i+j+len/2] * w;
                a[i+j] = u + v;
                a[i+j+len/2] = u - v;
                w *= wlen;
            }
        }
    }

    if (invert) {
        for (cd & x : a)
            x /= n;
    }
}


vector<int> multiply(vector<int> const& a, vector<int> const& b) {
    vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
    int n = 1;
    while (n < a.size() + b.size()) 
        n <<= 1;
    fa.resize(n);
    fb.resize(n);

    fft(fa, false);
    fft(fb, false);
    for (int i = 0; i < n; i++)
        fa[i] *= fb[i];
    fft(fa, true);

    vector<int> result(n);
    for (int i = 0; i < n; i++)
        result[i] = round(fa[i].real());
    return result;
}


int rev[mod], P[mod];

int32_t main() {
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int g = generator(mod);
	P[0] = 1;
	for(int i = 0; i < mod; i++) {
		rev[POW(g, i, mod)] = i;
	}
	vector <int> f(mod, 0);
	int n; cin >> n;
	for(int i = 1; i <= n; i++) {
		int x; cin >> x;
		if(x) {
			f[rev[x]]++;
		}
	}
	int ans = 0;
	vector <int> ff = f, gg = f;
	vector <int> v = multiply(ff, gg);
	for(int i = 1; i < v.size(); i++) {
		int x = POW(g, i, mod);
		ans += (v[i] / 2) * x;
		if(i + i < v.size() && i < f.size() && f[i]) {
			v[i + i] -= f[i] * f[i];
			int y = POW(g, i + i, mod);
			ans += (f[i] * (f[i] - 1) / 2) * y;
		}
	}
	cout << ans << endl;
}