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>
namespace IO {
const int maxn(1 << 21 | 1);
char ibuf[maxn], *iS, *iT, obuf[maxn], *oS = obuf, *oT = obuf + maxn - 1, _c,
                                       st[55];
int _f, tp;
char Getc() {
  return (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, maxn, stdin),
                      (iS == iT ? EOF : *iS++))
                   : *iS++);
}
void Flush() {
  fwrite(obuf, 1, oS - obuf, stdout);
  oS = obuf;
}
void Putc(char x) {
  *oS++ = x;
  if (oS == oT) Flush();
}
template <class Int>
void Input(Int &x) {
  for (_f = 0, _c = Getc(); _c < '0' || _c > '9'; _c = Getc()) _f = _c == '-';
  for (x = 0; _c <= '9' && _c >= '0'; _c = Getc())
    x = (x << 3) + (x << 1) + (_c ^ 48);
  if (_f) x = -x;
}
}  // namespace IO
using namespace IO;
using namespace std;
const long long _ = 1e6, yl = 1e9 + 7;
long long n, F[_ + 1], G[_ + 1], cnt[_ + 1];
void merge(int x, int y) {
  F[x] = (F[x] * cnt[y] + cnt[x] * F[y] + 2 * G[x] * G[y]) % yl;
  G[x] = (G[x] * cnt[y] + G[y] * cnt[x]) % yl;
  cnt[x] = cnt[x] * cnt[y] % yl;
}
long long POW(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % yl;
    x = x * x % yl;
    y >>= 1;
  }
  return res;
}
inline void dec(long long &x, long long y) { x = x < y ? x - y + yl : x - y; }
void solve() {
  for (int i = 1; i <= 100000; i *= 10)
    for (int j = 0, s = i * 10; j < _; j += s)
      for (int k = 0; k < i; ++k)
        for (int l = 8; ~l; --l) merge(j + k + i * l, j + k + i * l + i);
  for (int i = 1; i <= 100000; i *= 10)
    for (int j = 0, s = i * 10; j < _; j += s)
      for (int k = 0; k < i; ++k)
        for (int l = 0; l < 9; ++l) dec(F[j + k + i * l], F[j + k + i * l + i]);
  long long ans = 0;
  for (int i = 1; i < _; ++i) ans ^= F[i] * i;
  cout << ans << endl;
}
int main() {
  Input(n);
  for (int i = 0; i < _; ++i) cnt[i] = 1;
  for (int i = 1; i <= n; ++i) {
    long long x;
    Input(x);
    cnt[_] = 2;
    F[_] = x * x % yl;
    G[_] = x;
    merge(x, _);
  }
  return solve(), 0;
}