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 debug(x) {cerr << #x << " = " << x << '\n';}
#define PR(a, n) {cerr << #a << " = "; for (int _=1; _<=n; ++_) cerr << a[_] << ' '; cerr << '\n';}
#define PR0(a, n) {cerr << #a << " = "; for (int _=0; _<n; ++_) cerr << a[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"


const int P = 200003;


int64_t getPow(int n, int k) {
    if (k == 0) {
        return 1;
    }

    int64_t tmp = getPow(n, k / 2);

    if (k % 2 == 0) {
        return tmp * tmp % P;
    }
    return tmp * tmp % P * n % P;
}


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

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

    for (int i = 1, j = 0; i < n; i++) {
        int bit = n >> 1;
        for (; j & bit; bit >>= 1)
            j ^= bit;
        j ^= bit;

        if (i < j)
            swap(a[i], a[j]);
    }

    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<int64_t> 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<int64_t> result(n);
    for (int i = 0; i < n; i++)
        result[i] = round(fa[i].real());
    return result;
}


int main() {
    #ifdef GLASSES_GIRL
        freopen(FILE_NAME".in", "r", stdin);
    #endif

    map<int, int> s;

    for (int i = 0; i + 1 < P; ++i) {
        s[getPow(2, i)] = i;
    }

    int n;
    cin >> n;

    vector<int> a(P - 1);
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        // debug(s[x]);
        if (x != 0) {
            ++a[s[x]];
        }
    }
    
    vector<int64_t> b = multiply(a, a);

    int64_t res = 0;
    for (int i = 0; i < 2 * P; ++i) {
        res += getPow(2, i) * b[i]; 
        // if (b[i]) {
        //     cerr << i << ' ' << b[i] << '\n';
        // }
    }

    for (int i = 0; i + 1 < P; ++i) {
        res -= getPow(2, 2 * i) * a[i];
    }

    cout << res / 2 << '\n';
}