#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
template <unsigned MOD>
struct ModInt {
  static const unsigned static_MOD = MOD;
  unsigned x;
  void undef() { x = (unsigned)-1; }
  bool isnan() const { return x == (unsigned)-1; }
  inline int geti() const { return (int)x; }
  ModInt() { x = 0; }
  ModInt(const ModInt &y) { x = y.x; }
  ModInt(int y) {
    if (y < 0 || (int)MOD <= y) y %= (int)MOD;
    if (y < 0) y += MOD;
    x = y;
  }
  ModInt(unsigned y) {
    if (MOD <= y)
      x = y % MOD;
    else
      x = y;
  }
  ModInt(long long y) {
    if (y < 0 || MOD <= y) y %= MOD;
    if (y < 0) y += MOD;
    x = y;
  }
  ModInt(unsigned long long y) {
    if (MOD <= y)
      x = y % MOD;
    else
      x = y;
  }
  ModInt &operator+=(const ModInt y) {
    if ((x += y.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(const ModInt y) {
    if ((x -= y.x) & (1u << 31)) x += MOD;
    return *this;
  }
  ModInt &operator*=(const ModInt y) {
    x = (unsigned long long)x * y.x % MOD;
    return *this;
  }
  ModInt &operator/=(const ModInt y) {
    x = (unsigned long long)x * y.inv().x % MOD;
    return *this;
  }
  ModInt operator-() const { return (x ? MOD - x : 0); }
  ModInt inv() const {
    unsigned a = MOD, b = x;
    int u = 0, v = 1;
    while (b) {
      int t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    if (u < 0) u += MOD;
    return ModInt(u);
  }
  ModInt pow(long long y) const {
    ModInt b = *this, r = 1;
    if (y < 0) {
      b = b.inv();
      y = -y;
    }
    for (; y; y >>= 1) {
      if (y & 1) r *= b;
      b *= b;
    }
    return r;
  }
  friend ModInt operator+(ModInt x, const ModInt y) { return x += y; }
  friend ModInt operator-(ModInt x, const ModInt y) { return x -= y; }
  friend ModInt operator*(ModInt x, const ModInt y) { return x *= y; }
  friend ModInt operator/(ModInt x, const ModInt y) { return x *= y.inv(); }
  friend bool operator<(const ModInt x, const ModInt y) { return x.x < y.x; }
  friend bool operator==(const ModInt x, const ModInt y) { return x.x == y.x; }
  friend bool operator!=(const ModInt x, const ModInt y) { return x.x != y.x; }
};
const int MAX = 2000111;
int min_factor[MAX + 1];
vector<int> prime;
void make_prime() {
  for (int i = 2; i <= MAX; i += 2) min_factor[i] = 2;
  for (int i = 3; i <= MAX; i += 3)
    if (!min_factor[i]) min_factor[i] = 3;
  for (int i = 5, d = 2; i * i <= MAX;) {
    if (!min_factor[i]) {
      min_factor[i] = i;
      for (int j = i * i; j <= MAX; j += i)
        if (!min_factor[j]) min_factor[j] = i;
    }
    i += d;
    d = 6 - d;
  }
  for (int i = 2; i <= MAX; i++) {
    if (min_factor[i] == 0) min_factor[i] = i;
    if (min_factor[i] == i) prime.push_back(i);
  }
}
const long long MOD = 1000000007;
int N, K;
ModInt<MOD> C[MAX];
int mu[MAX];
void MAIN() {
  make_prime();
  for (int i = 0, i_len = (MAX); i < i_len; ++i) mu[i] = 1;
  for (__typeof((prime).begin()) e = (prime).begin(), e_end = (prime).end();
       e != e_end; ++e) {
    for (int k = *e; k < MAX; k += *e) {
      mu[k] = -mu[k];
    }
    long long d = (long long)*e * *e;
    for (long long k = d; k < MAX; k += d) {
      mu[k] = 0;
    }
  }
  scanf("%d%d", &N, &K);
  ModInt<MOD> ans_all = 0;
  ModInt<MOD> pre = 0;
  for (int i = 1; i <= K; i++) {
    ModInt<MOD> ans = ModInt<MOD>(i).pow(N) - ModInt<MOD>(i - 1).pow(N);
    for (int k = i + i, t = 2; k <= K; k += i, t++) {
      C[k] += mu[t] * ans;
    }
    ans += C[i];
    ans += pre;
    ans_all += ans.geti() ^ i;
    pre = ans;
  }
  printf("%d\n", ans_all.geti());
}
int main() {
  int TC = 1;
  for (int tc = 0, tc_len = (TC); tc < tc_len; ++tc) MAIN();
  return 0;
}

### Prompt

Your task is to create a CPP solution to the following problem:

Let's call an array a of size n coprime iff gcd(a1, a2, ..., an) = 1, where gcd is the greatest common divisor of the arguments.

You are given two numbers n and k. For each i (1 ≤ i ≤ k) you have to determine the number of coprime arrays a of size n such that for every j (1 ≤ j ≤ n) 1 ≤ aj ≤ i. Since the answers can be very large, you have to calculate them modulo 109 + 7.

Input

The first line contains two integers n and k (1 ≤ n, k ≤ 2·106) — the size of the desired arrays and the maximum upper bound on elements, respectively.

Output

Since printing 2·106 numbers may take a lot of time, you have to output the answer in such a way:

Let bi be the number of coprime arrays with elements in range [1, i], taken modulo 109 + 7. You have to print <image>, taken modulo 109 + 7. Here <image> denotes bitwise xor operation (^ in C++ or Java, xor in Pascal).

Examples

Input

3 4


Output

82


Input

2000000 8


Output

339310063

Note

Explanation of the example:

Since the number of coprime arrays is large, we will list the arrays that are non-coprime, but contain only elements in range [1, i]:

For i = 1, the only array is coprime. b1 = 1.

For i = 2, array [2, 2, 2] is not coprime. b2 = 7.

For i = 3, arrays [2, 2, 2] and [3, 3, 3] are not coprime. b3 = 25.

For i = 4, arrays [2, 2, 2], [3, 3, 3], [2, 2, 4], [2, 4, 2], [2, 4, 4], [4, 2, 2], [4, 2, 4], [4, 4, 2] and [4, 4, 4] are not coprime. b4 = 55.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &x, const T &y) {
  if (y < x) x = y;
}
template <class T>
inline void amax(T &x, const T &y) {
  if (x < y) x = y;
}
template <class Iter>
void rprintf(const char *fmt, Iter begin, Iter end) {
  for (bool sp = 0; begin != end; ++begin) {
    if (sp)
      putchar(' ');
    else
      sp = true;
    printf(fmt, *begin);
  }
  putchar('\n');
}
template <unsigned MOD>
struct ModInt {
  static const unsigned static_MOD = MOD;
  unsigned x;
  void undef() { x = (unsigned)-1; }
  bool isnan() const { return x == (unsigned)-1; }
  inline int geti() const { return (int)x; }
  ModInt() { x = 0; }
  ModInt(const ModInt &y) { x = y.x; }
  ModInt(int y) {
    if (y < 0 || (int)MOD <= y) y %= (int)MOD;
    if (y < 0) y += MOD;
    x = y;
  }
  ModInt(unsigned y) {
    if (MOD <= y)
      x = y % MOD;
    else
      x = y;
  }
  ModInt(long long y) {
    if (y < 0 || MOD <= y) y %= MOD;
    if (y < 0) y += MOD;
    x = y;
  }
  ModInt(unsigned long long y) {
    if (MOD <= y)
      x = y % MOD;
    else
      x = y;
  }
  ModInt &operator+=(const ModInt y) {
    if ((x += y.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(const ModInt y) {
    if ((x -= y.x) & (1u << 31)) x += MOD;
    return *this;
  }
  ModInt &operator*=(const ModInt y) {
    x = (unsigned long long)x * y.x % MOD;
    return *this;
  }
  ModInt &operator/=(const ModInt y) {
    x = (unsigned long long)x * y.inv().x % MOD;
    return *this;
  }
  ModInt operator-() const { return (x ? MOD - x : 0); }
  ModInt inv() const {
    unsigned a = MOD, b = x;
    int u = 0, v = 1;
    while (b) {
      int t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    if (u < 0) u += MOD;
    return ModInt(u);
  }
  ModInt pow(long long y) const {
    ModInt b = *this, r = 1;
    if (y < 0) {
      b = b.inv();
      y = -y;
    }
    for (; y; y >>= 1) {
      if (y & 1) r *= b;
      b *= b;
    }
    return r;
  }
  friend ModInt operator+(ModInt x, const ModInt y) { return x += y; }
  friend ModInt operator-(ModInt x, const ModInt y) { return x -= y; }
  friend ModInt operator*(ModInt x, const ModInt y) { return x *= y; }
  friend ModInt operator/(ModInt x, const ModInt y) { return x *= y.inv(); }
  friend bool operator<(const ModInt x, const ModInt y) { return x.x < y.x; }
  friend bool operator==(const ModInt x, const ModInt y) { return x.x == y.x; }
  friend bool operator!=(const ModInt x, const ModInt y) { return x.x != y.x; }
};
const int MAX = 2000111;
int min_factor[MAX + 1];
vector<int> prime;
void make_prime() {
  for (int i = 2; i <= MAX; i += 2) min_factor[i] = 2;
  for (int i = 3; i <= MAX; i += 3)
    if (!min_factor[i]) min_factor[i] = 3;
  for (int i = 5, d = 2; i * i <= MAX;) {
    if (!min_factor[i]) {
      min_factor[i] = i;
      for (int j = i * i; j <= MAX; j += i)
        if (!min_factor[j]) min_factor[j] = i;
    }
    i += d;
    d = 6 - d;
  }
  for (int i = 2; i <= MAX; i++) {
    if (min_factor[i] == 0) min_factor[i] = i;
    if (min_factor[i] == i) prime.push_back(i);
  }
}
const long long MOD = 1000000007;
int N, K;
ModInt<MOD> C[MAX];
int mu[MAX];
void MAIN() {
  make_prime();
  for (int i = 0, i_len = (MAX); i < i_len; ++i) mu[i] = 1;
  for (__typeof((prime).begin()) e = (prime).begin(), e_end = (prime).end();
       e != e_end; ++e) {
    for (int k = *e; k < MAX; k += *e) {
      mu[k] = -mu[k];
    }
    long long d = (long long)*e * *e;
    for (long long k = d; k < MAX; k += d) {
      mu[k] = 0;
    }
  }
  scanf("%d%d", &N, &K);
  ModInt<MOD> ans_all = 0;
  ModInt<MOD> pre = 0;
  for (int i = 1; i <= K; i++) {
    ModInt<MOD> ans = ModInt<MOD>(i).pow(N) - ModInt<MOD>(i - 1).pow(N);
    for (int k = i + i, t = 2; k <= K; k += i, t++) {
      C[k] += mu[t] * ans;
    }
    ans += C[i];
    ans += pre;
    ans_all += ans.geti() ^ i;
    pre = ans;
  }
  printf("%d\n", ans_all.geti());
}
int main() {
  int TC = 1;
  for (int tc = 0, tc_len = (TC); tc < tc_len; ++tc) MAIN();
  return 0;
}

```