#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e1 + 10, MOD = 998244353;
const int MAXM = 1e5 + 10;
template <int MOD_>
struct modnum {
  static constexpr int MOD = MOD_;
  static_assert(MOD_ > 0, "MOD must be positive");

 private:
  using long long = long long;
  int v;
  static int minv(int a, int m) {
    a %= m;
    assert(a);
    return a == 1 ? 1 : int(m - long long(minv(m, a)) * long long(m) / a);
  }

 public:
  modnum() : v(0) {}
  modnum(long long v_) : v(int(v_ % MOD)) {
    if (v < 0) v += MOD;
  }
  explicit operator int() const { return v; }
  friend std::ostream& operator<<(std::ostream& out, const modnum& n) {
    return out << int(n);
  }
  friend std::istream& operator>>(std::istream& in, modnum& n) {
    long long v_;
    in >> v_;
    n = modnum(v_);
    return in;
  }
  friend bool operator==(const modnum& a, const modnum& b) {
    return a.v == b.v;
  }
  friend bool operator!=(const modnum& a, const modnum& b) {
    return a.v != b.v;
  }
  modnum inv() const {
    modnum res;
    res.v = minv(v, MOD);
    return res;
  }
  friend modnum inv(const modnum& m) { return m.inv(); }
  modnum neg() const {
    modnum res;
    res.v = v ? MOD - v : 0;
    return res;
  }
  friend modnum neg(const modnum& m) { return m.neg(); }
  modnum operator-() const { return neg(); }
  modnum operator+() const { return modnum(*this); }
  modnum& operator++() {
    v++;
    if (v == MOD) v = 0;
    return *this;
  }
  modnum& operator--() {
    if (v == 0) v = MOD;
    v--;
    return *this;
  }
  modnum& operator+=(const modnum& o) {
    v -= MOD - o.v;
    v = (v < 0) ? v + MOD : v;
    return *this;
  }
  modnum& operator-=(const modnum& o) {
    v -= o.v;
    v = (v < 0) ? v + MOD : v;
    return *this;
  }
  modnum& operator*=(const modnum& o) {
    v = int(long long(v) * long long(o.v) % MOD);
    return *this;
  }
  modnum& operator/=(const modnum& o) { return *this *= o.inv(); }
  friend modnum operator++(modnum& a, int) {
    modnum r = a;
    ++a;
    return r;
  }
  friend modnum operator--(modnum& a, int) {
    modnum r = a;
    --a;
    return r;
  }
  friend modnum operator+(const modnum& a, const modnum& b) {
    return modnum(a) += b;
  }
  friend modnum operator-(const modnum& a, const modnum& b) {
    return modnum(a) -= b;
  }
  friend modnum operator*(const modnum& a, const modnum& b) {
    return modnum(a) *= b;
  }
  friend modnum operator/(const modnum& a, const modnum& b) {
    return modnum(a) /= b;
  }
};
using num = modnum<MOD>;
const int MAXV = 2e6 + 10;
int pf[MAXV];
void prep() {
  memset(pf, -1, sizeof(pf));
  for (int i = 2; i < MAXV; i++)
    if (pf[i] == -1) {
      for (int j = i; j < MAXV; j += i) pf[j] = i;
    }
}
int get_mul(int c) {
  int ans = 0;
  while (c > 1) {
    int p = pf[c];
    c /= p;
    if (c % p == 0) return 0;
    ans ^= 1;
  }
  return (ans == 0 ? 1 : -1);
}
int n, m;
array<int, 2> a[MAXN], b[MAXN];
num get(int d) {
  int bound = m / d;
  for (int i = 0; i < n; i++) {
    b[i][0] = (a[i][0] + d - 1) / d;
    b[i][1] = a[i][1] / d;
  }
  vector<num> pre(bound + 1, 1), cur(bound + 1);
  for (int rep = 0; rep < n; rep++) {
    int l = b[rep][0], r = b[rep][1];
    auto get = [&](int i) -> num { return i >= 0 ? pre[i] : 0; };
    for (int i = 0; i <= bound; i++) {
      cur[i] = get(i - l) - get(i - r - 1);
    }
    for (int i = 0; i <= bound; i++) {
      pre[i] = cur[i], cur[i] = 0;
      if (i) pre[i] += pre[i - 1];
    }
  }
  return pre[bound];
}
void solve() {
  prep();
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1];
  num ans = 0;
  for (int d = 1; d <= m; d++) {
    int mul = get_mul(d);
    ans += get(d) * mul;
  }
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T = 1;
  while (T--) solve();
}

### Prompt

Generate a Cpp solution to the following problem:

Mocha wants to be an astrologer. There are n stars which can be seen in Zhijiang, and the brightness of the i-th star is a_i. 

Mocha considers that these n stars form a constellation, and she uses (a_1,a_2,…,a_n) to show its state. A state is called mathematical if all of the following three conditions are satisfied:

  * For all i (1≤ i≤ n), a_i is an integer in the range [l_i, r_i].
  * ∑  _{i=1} ^ n a_i ≤ m.
  * \gcd(a_1,a_2,…,a_n)=1.



Here, \gcd(a_1,a_2,…,a_n) denotes the [greatest common divisor (GCD)](https://en.wikipedia.org/wiki/Greatest_common_divisor) of integers a_1,a_2,…,a_n.

Mocha is wondering how many different mathematical states of this constellation exist. Because the answer may be large, you must find it modulo 998 244 353.

Two states (a_1,a_2,…,a_n) and (b_1,b_2,…,b_n) are considered different if there exists i (1≤ i≤ n) such that a_i ≠ b_i.

Input

The first line contains two integers n and m (2 ≤ n ≤ 50, 1 ≤ m ≤ 10^5) — the number of stars and the upper bound of the sum of the brightness of stars.

Each of the next n lines contains two integers l_i and r_i (1 ≤ l_i ≤ r_i ≤ m) — the range of the brightness of the i-th star.

Output

Print a single integer — the number of different mathematical states of this constellation, modulo 998 244 353.

Examples

Input


2 4
1 3
1 2


Output


4

Input


5 10
1 10
1 10
1 10
1 10
1 10


Output


251

Input


5 100
1 94
1 96
1 91
4 96
6 97


Output


47464146

Note

In the first example, there are 4 different mathematical states of this constellation:

  * a_1=1, a_2=1.
  * a_1=1, a_2=2.
  * a_1=2, a_2=1.
  * a_1=3, a_2=1.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e1 + 10, MOD = 998244353;
const int MAXM = 1e5 + 10;
template <int MOD_>
struct modnum {
  static constexpr int MOD = MOD_;
  static_assert(MOD_ > 0, "MOD must be positive");

 private:
  using long long = long long;
  int v;
  static int minv(int a, int m) {
    a %= m;
    assert(a);
    return a == 1 ? 1 : int(m - long long(minv(m, a)) * long long(m) / a);
  }

 public:
  modnum() : v(0) {}
  modnum(long long v_) : v(int(v_ % MOD)) {
    if (v < 0) v += MOD;
  }
  explicit operator int() const { return v; }
  friend std::ostream& operator<<(std::ostream& out, const modnum& n) {
    return out << int(n);
  }
  friend std::istream& operator>>(std::istream& in, modnum& n) {
    long long v_;
    in >> v_;
    n = modnum(v_);
    return in;
  }
  friend bool operator==(const modnum& a, const modnum& b) {
    return a.v == b.v;
  }
  friend bool operator!=(const modnum& a, const modnum& b) {
    return a.v != b.v;
  }
  modnum inv() const {
    modnum res;
    res.v = minv(v, MOD);
    return res;
  }
  friend modnum inv(const modnum& m) { return m.inv(); }
  modnum neg() const {
    modnum res;
    res.v = v ? MOD - v : 0;
    return res;
  }
  friend modnum neg(const modnum& m) { return m.neg(); }
  modnum operator-() const { return neg(); }
  modnum operator+() const { return modnum(*this); }
  modnum& operator++() {
    v++;
    if (v == MOD) v = 0;
    return *this;
  }
  modnum& operator--() {
    if (v == 0) v = MOD;
    v--;
    return *this;
  }
  modnum& operator+=(const modnum& o) {
    v -= MOD - o.v;
    v = (v < 0) ? v + MOD : v;
    return *this;
  }
  modnum& operator-=(const modnum& o) {
    v -= o.v;
    v = (v < 0) ? v + MOD : v;
    return *this;
  }
  modnum& operator*=(const modnum& o) {
    v = int(long long(v) * long long(o.v) % MOD);
    return *this;
  }
  modnum& operator/=(const modnum& o) { return *this *= o.inv(); }
  friend modnum operator++(modnum& a, int) {
    modnum r = a;
    ++a;
    return r;
  }
  friend modnum operator--(modnum& a, int) {
    modnum r = a;
    --a;
    return r;
  }
  friend modnum operator+(const modnum& a, const modnum& b) {
    return modnum(a) += b;
  }
  friend modnum operator-(const modnum& a, const modnum& b) {
    return modnum(a) -= b;
  }
  friend modnum operator*(const modnum& a, const modnum& b) {
    return modnum(a) *= b;
  }
  friend modnum operator/(const modnum& a, const modnum& b) {
    return modnum(a) /= b;
  }
};
using num = modnum<MOD>;
const int MAXV = 2e6 + 10;
int pf[MAXV];
void prep() {
  memset(pf, -1, sizeof(pf));
  for (int i = 2; i < MAXV; i++)
    if (pf[i] == -1) {
      for (int j = i; j < MAXV; j += i) pf[j] = i;
    }
}
int get_mul(int c) {
  int ans = 0;
  while (c > 1) {
    int p = pf[c];
    c /= p;
    if (c % p == 0) return 0;
    ans ^= 1;
  }
  return (ans == 0 ? 1 : -1);
}
int n, m;
array<int, 2> a[MAXN], b[MAXN];
num get(int d) {
  int bound = m / d;
  for (int i = 0; i < n; i++) {
    b[i][0] = (a[i][0] + d - 1) / d;
    b[i][1] = a[i][1] / d;
  }
  vector<num> pre(bound + 1, 1), cur(bound + 1);
  for (int rep = 0; rep < n; rep++) {
    int l = b[rep][0], r = b[rep][1];
    auto get = [&](int i) -> num { return i >= 0 ? pre[i] : 0; };
    for (int i = 0; i <= bound; i++) {
      cur[i] = get(i - l) - get(i - r - 1);
    }
    for (int i = 0; i <= bound; i++) {
      pre[i] = cur[i], cur[i] = 0;
      if (i) pre[i] += pre[i - 1];
    }
  }
  return pre[bound];
}
void solve() {
  prep();
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1];
  num ans = 0;
  for (int d = 1; d <= m; d++) {
    int mul = get_mul(d);
    ans += get(d) * mul;
  }
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T = 1;
  while (T--) solve();
}

```