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;
char readchar() {
  static char buf[1 << 15], *ptr = buf, *end = buf;
  if (ptr == end) ptr = buf, end = buf + fread(buf, 1, 1 << 15, stdin);
  return *ptr++;
}
void writechar(char c = 0) {
  static char buf[1 << 15], *ptr = buf;
  if (ptr == end(buf) or c == 0) fwrite(buf, 1, ptr - buf, stdout), ptr = buf;
  *ptr++ = c;
}
template <class Z = int>
Z getint() {
  char c = readchar();
  bool neg = c == '-';
  Z res = neg ? 0 : c - '0';
  while (isdigit(c = readchar())) res = res * 10 + (c - '0');
  return neg ? -res : res;
}
template <class Z>
void putint(Z a, char delim = '\n') {
  if (a < 0) writechar('-'), a = -a;
  int d[40], i = 0;
  do d[i++] = a % 10;
  while (a /= 10);
  while (i--) writechar('0' + d[i]);
  writechar(delim);
}
string getstring(char delim = '\n') {
  string res;
  for (char c; (c = readchar()) != delim;) res += c;
  return res;
}
void putstring(string s, char delim = '\n') {
  for (char c : s) writechar(c);
  writechar(delim);
}
template <class T, class Op = multiplies<T>>
T power(T a, long long n, Op op = multiplies<T>(), T e = {1}) {
  assert(n >= 0);
  while (n) {
    if (n & 1) e = op(e, a);
    if (n >>= 1) a = op(a, a);
  }
  return e;
}
template <unsigned M>
struct modular {
  using m = modular;
  unsigned v;
  modular(long long x = 0) : v((x %= M) < 0 ? x + M : x) {}
  m operator-() const { return m() -= *this; }
  m& operator+=(m b) {
    if ((v += b.v) >= M) v -= M;
    return *this;
  }
  m& operator-=(m b) {
    if (v < b.v) v += M;
    v -= b.v;
    return *this;
  }
  m& operator*=(m b) {
    auto x = (uint64_t)v * b.v;
    unsigned xu = x >> 32, xl = x, d;
    asm("divl %4; \n\t" : "=a"(d), "=d"(v) : "d"(xu), "a"(xl), "r"(M));
    return *this;
  }
  m& operator/=(m b) { return *this *= power(b, M - 2); }
  friend m operator+(m a, m b) { return a += b; }
  friend m operator-(m a, m b) { return a -= b; }
  friend m operator*(m a, m b) { return a *= b; }
  friend m operator/(m a, m b) { return a /= b; }
  friend bool operator==(m a, m b) { return a.v == b.v; }
  friend string to_string(m a) { return to_string(a.v); }
};
constexpr long long mod = 1e9 + 7;
using mint = modular<mod>;
int main() {
  int n = getint();
  vector<int> cnt(1e6);
  while (n--) {
    ++cnt[getint()];
  }
  vector<mint> p2(1e6 + 1), sum(1e6), sum2(1e6);
  for (int i = 0; i <= 1e6; ++i) {
    p2[i] = i ? 2 * p2[i - 1] : 1;
  }
  for (int i = 0; i < 1e6; ++i) {
    if (cnt[i] == 0) {
      continue;
    }
    sum[i] = cnt[i] * p2[cnt[i] - 1] * i;
    sum2[i] = (long long)cnt[i] * (cnt[i] + 1) / 2 * p2[cnt[i] - 1] * i * i;
  }
  for (int k = 0; k < 6; ++k) {
    int tenk = power(10, k);
    for (int i = 1e6; i--;) {
      if (i / tenk % 10) {
        int j = i - tenk;
        sum2[j] =
            sum2[i] * p2[cnt[j]] + sum2[j] * p2[cnt[i]] + 2 * sum[i] * sum[j];
        sum[j] = sum[i] * p2[cnt[j]] + sum[j] * p2[cnt[i]];
        cnt[j] += cnt[i];
      }
    }
  }
  for (int k = 0; k < 6; ++k) {
    int tenk = power(10, k);
    for (int i = 0; i < 1e6; ++i) {
      if (i / tenk % 10) {
        int j = i - tenk;
        sum2[j] -= sum2[i];
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < 1e6; ++i) {
    res ^= (long long)i * sum2[i].v;
  }
  putint(res);
  writechar();
}