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>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
const int maxn = (int)1e6 - 1, mod = (int)1e9 + 7;
int cnt[maxn + 1];
long long sum[maxn + 1];
long long sumsq[maxn + 1];
long long sumo[maxn + 1];
int st[6];
void push(int x, int y, int pos, int cn, int now) {
  if (pos == 6) {
    if (now == x) {
      return;
    }
    if (cn == 1) {
      sum[now] = (sum[now] + sum[x]) % mod;
      sumsq[now] = (sumsq[now] + sumsq[x]) % mod;
      sumo[now] = sumo[now] + sumo[x];
    } else {
      sum[now] = (sum[now] - sum[x]);
      sumsq[now] = (sumsq[now] - sumsq[x]);
      sumo[now] = sumo[now] - sumo[x];
      if (sum[now] < 0) {
        sum[now] += mod;
      }
      if (sumsq[now] < 0) {
        sumsq[now] += mod;
      }
    }
  } else {
    int z = y % 10;
    push(x, y / 10, pos + 1, cn, now + z * st[pos]);
    if (z != 0) {
      push(x, y / 10, pos + 1, cn ^ 1, now + (z - 1) * st[pos]);
    }
  }
}
long long ans[maxn + 1];
void go(int x, int y, int pos, int cn, int now) {
  if (pos == 6) {
    if (now == x) {
      return;
    }
    if (cn == 1) {
      ans[x] -= ans[now];
      if (ans[x] < 0) {
        ans[x] += mod;
      }
    } else {
      ans[x] += ans[now];
      if (ans[x] >= mod) {
        ans[x] -= mod;
      }
    }
  } else {
    int z = y % 10;
    go(x, y / 10, pos + 1, cn, now + z * st[pos]);
    if (z != 9) {
      go(x, y / 10, pos + 1, cn ^ 1, now + (z + 1) * st[pos]);
    }
  }
}
long long my_pow(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  if (b & 1) {
    return a * my_pow(a, b - 1) % mod;
  }
  long long z = my_pow(a, b >> 1);
  return z * z % mod;
}
long long m[maxn + 10];
int main() {
  m[0] = 1;
  st[0] = 1;
  for (int i = 1; i < 6; i++) {
    st[i] = st[i - 1] * 10;
  }
  for (int i = 1; i < maxn + 10; i++) {
    m[i] = m[i - 1] * 2;
    if (m[i] >= mod) {
      m[i] -= mod;
    }
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  for (int i = maxn; i >= 0; i--) {
    sumo[i] = (sumo[i] + cnt[i]) % mod;
    sum[i] = (sum[i] + (long long)i * cnt[i]) % mod;
    sumsq[i] = (sumsq[i] + (long long)((long long)i * i % mod) * cnt[i]) % mod;
    if (sumo[i] != 0) {
      push(i, i, 0, 0, 0);
    }
  }
  long long res = 0;
  for (int i = maxn; i >= 0; i--) {
    long long sq = sumsq[i];
    long long sums = (sum[i] * sum[i] - sumsq[i]);
    sums %= mod;
    if (sums < 0) {
      sums += mod;
    }
    long long o = sumo[i];
    if (o > 1) {
      ans[i] = (sq * m[o - 1] + sums * m[o - 2]);
      ans[i] %= mod;
    } else if (o == 1) {
      ans[i] = sq;
    }
    long long h = ans[i];
    go(i, i, 0, 0, 0);
    res ^= ans[i] * i;
    ans[i] = h;
  }
  cout << res << endl;
  return 0;
}