Problem: You are given n integers a1, a2, ..., an. Denote this list of integers as T.

Let f(L) be a function that takes in a non-empty list of integers L.

The function will output another integer as follows: 

  * First, all integers in L are padded with leading zeros so they are all the same length as the maximum length number in L. 
  * We will construct a string where the i-th character is the minimum of the i-th character in padded input numbers. 
  * The output is the number representing the string interpreted in base 10. 



For example f(10, 9) = 0, f(123, 321) = 121, f(530, 932, 81) = 30.

Define the function 

<image> Here, <image> denotes a subsequence.

In other words, G(x) is the sum of squares of sum of elements of nonempty subsequences of T that evaluate to x when plugged into f modulo 1 000 000 007, then multiplied by x. The last multiplication is not modded. 

You would like to compute G(0), G(1), ..., G(999 999). To reduce the output size, print the value <image>, where <image> denotes the bitwise XOR operator.

Input

The first line contains the integer n (1 ≤ n ≤ 1 000 000) — the size of list T.

The next line contains n space-separated integers, a1, a2, ..., an (0 ≤ ai ≤ 999 999) — the elements of the list. 

Output

Output a single integer, the answer to the problem.

Examples

Input

3
123 321 555


Output

292711924


Input

1
999999


Output

997992010006992


Input

10
1 1 1 1 1 1 1 1 1 1


Output

28160

Note

For the first sample, the nonzero values of G are G(121) = 144 611 577, G(123) = 58 401 999, G(321) = 279 403 857, G(555) = 170 953 875. The bitwise XOR of these numbers is equal to 292 711 924.

For example, <image>, since the subsequences [123] and [123, 555] evaluate to 123 when plugged into f.

For the second sample, we have <image>

For the last sample, we have <image>, where <image> is the binomial coefficient.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
ll fexp(ll b, ll e = mod - 2) {
  ll ans = 1;
  while (e) {
    if (e & 1) ans = ans * b % mod;
    b = b * b % mod;
    e /= 2;
  }
  return ans;
}
template <typename T>
vector<T> operator+(const vector<T> &a, const vector<T> &b) {
  vector<T> ans(a.size());
  for (size_t i = 0; i < a.size(); i++) ans[i] = a[i] + b[i];
  return ans;
}
template <typename T>
vector<T> operator-(const vector<T> &a, const vector<T> &b) {
  vector<T> ans(a.size());
  for (size_t i = 0; i < a.size(); i++) ans[i] = (a[i] - b[i] + mod) % mod;
  return ans;
}
struct tad {
  ll s, s2, cnt;
  tad() : s(0), s2(0), cnt(0) {}
  tad operator+(const tad &o) const {
    tad ans;
    ans.s = (s + o.s + s * o.cnt + o.s * cnt) % mod;
    ans.cnt = (cnt + o.cnt + cnt * o.cnt) % mod;
    ans.s2 = s2 + o.s2 + s2 * o.cnt + o.s2 * cnt + 2 * s * o.s;
    ans.s2 %= mod;
    return ans;
  }
};
size_t all;
vector<ll> f(const vector<tad> &cnt) {
  if ((int)cnt.size() == 1) {
    return vector<ll>{cnt[0].s2};
  }
  vector<tad> cnt_f[10];
  for (int i = 0; i < 10; i++) cnt_f[i].resize(cnt.size() / 10);
  int subsize = int(cnt.size() / 10);
  for (int i = 0; i < (int)cnt.size(); i++) {
    cnt_f[i / subsize][i % subsize] = cnt[i];
  }
  vector<ll> g(cnt.size());
  vector<ll> tmp[10];
  for (int i = 9; i >= 0; i--) {
    if (i + 1 < 10) cnt_f[i] = cnt_f[i] + cnt_f[i + 1];
    tmp[i] = f(cnt_f[i]);
    auto cp = tmp[i];
    std::copy(cp.begin(), cp.end(), &g[i * subsize]);
  }
  return g;
}
vector<ll> f1(vector<ll> cnt) {
  if ((int)cnt.size() == 1) {
    return cnt;
  }
  vector<ll> cnt_f[10];
  for (int i = 0; i < 10; i++) cnt_f[i].resize(cnt.size() / 10);
  int subsize = int(cnt.size() / 10);
  for (int i = 0; i < (int)cnt.size(); i++) {
    cnt_f[i / subsize][i % subsize] = cnt[i];
  }
  vector<ll> g;
  g.reserve(cnt.size());
  vector<ll> tmp[10];
  for (int i = 0; i < 10; i++) tmp[i] = f1(cnt_f[i]);
  for (int i = 0; i < 10; i++) {
    auto cp = tmp[i];
    if (i + 1 < 10) cp = cp - tmp[i + 1];
    g.insert(g.end(), cp.begin(), cp.end());
  }
  return g;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  for (int &x : v) scanf("%d", &x);
  vector<tad> vet(1000000);
  for (int x : v) {
    tad aux;
    aux.cnt = 1;
    aux.s = x;
    aux.s2 = 1LL * x * x % mod;
    vet[x] = vet[x] + aux;
  }
  auto qwe = f1(f(vet));
  ll ans = 0;
  for (int i = 0; i < (int)qwe.size(); i++) {
    if (qwe[i] <= 0) continue;
    ans ^= i * qwe[i];
  }
  printf("%lld\n", ans);
  return 0;
}