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;
const int PW = 6;
const int LIM = 1000000;
const int BASES[6] = {1, 10, 100, 1000, 10000, 100000};
inline int ith_digit(int x, int i) { return x / BASES[i] % 10; }
struct Data {
  ll n1 = 0;
  ll n = 0;
  ll s = 0;
  ll s2 = 0;
  int mn = 9999999;
};
vector<Data> f(LIM);
Data operator+(Data &lhs, Data &rhs) {
  Data ret;
  ret.n1 = lhs.n1 + rhs.n1;
  ret.n = (lhs.n + rhs.n + lhs.n * rhs.n) % MOD;
  ret.s = (lhs.s * rhs.n % MOD + lhs.n * rhs.s % MOD) % MOD;
  (ret.s += lhs.s + rhs.s) %= MOD;
  ret.s2 = (lhs.n * rhs.s2 % MOD + lhs.s2 * rhs.n % MOD) % MOD;
  (ret.s2 += lhs.s * rhs.s % MOD * 2LL % MOD) %= MOD;
  (ret.s2 += (lhs.s2 + rhs.s2) % MOD) %= MOD;
  int tmp = 0;
  for (int i = 0; i < PW; ++i)
    tmp += min(ith_digit(lhs.mn, i), ith_digit(rhs.mn, i)) * BASES[i];
  ret.mn = tmp;
  return ret;
}
ll ans;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    ll a;
    cin >> a;
    Data t;
    t.mn = a;
    t.n = 1;
    t.s2 = a * a % MOD;
    t.s = a;
    f[a] = f[a] + t;
  }
  for (int i = 0; i < LIM; ++i)
    if (f[i].mn == i) f[i].n1 = 1;
  for (int j = 0; j < PW; ++j) {
    for (int i = LIM - 1; i >= 0; --i) {
      if (ith_digit(i, j) < 9) {
        int x = i + BASES[j];
        f[i] = f[i] + f[x];
      }
    }
  }
  for (int i = 0; i < LIM; ++i)
    if (f[i].mn == i) {
      long long sum = 0;
      for (int m = 0; m < 1 << PW; ++m) {
        int nx = i;
        bool cnt = false, chk = true;
        for (int j = 0; j < PW; ++j)
          if (m >> j & 1 == 1) {
            if (ith_digit(i, j) == 9) {
              chk = false;
              break;
            }
            nx += BASES[j];
            cnt ^= 1;
          }
        if (chk) {
          if (!cnt)
            (sum += f[nx].s2) %= MOD;
          else
            (sum += MOD - f[nx].s2) %= MOD;
        }
      }
      sum *= i;
      ans ^= sum;
    }
  cout << ans << endl;
  return 0;
}