#include <bits/stdc++.h>
using namespace std;
template <int MOD_>
struct modnum {
  static constexpr int MOD = MOD_;
  static_assert(MOD_ > 0, "MOD must be positive");

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

 public:
  modnum() : v(0) {}
  modnum(ll 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) {
    ll 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 += o.v;
    if (v >= MOD) v -= MOD;
    return *this;
  }
  modnum& operator-=(const modnum& o) {
    v -= o.v;
    if (v < 0) v += MOD;
    return *this;
  }
  modnum& operator*=(const modnum& o) {
    v = int(ll(v) * ll(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;
  }
};
template <typename T>
T pow(T a, long long b) {
  assert(b >= 0);
  T r = 1;
  while (b) {
    if (b & 1) r *= a;
    b >>= 1;
    a *= a;
  }
  return r;
}
using num = modnum<998244353>;
const int X = 2.1e5;
bitset<X> is_prime;
vector<int> pr;
vector<int> mu(X, 0);
void init() {
  is_prime.flip();
  is_prime[0] = is_prime[1] = false;
  mu[1] = 1;
  for (int i = 2; i < X; i++) {
    if (is_prime[i]) {
      pr.push_back(i);
      mu[i] = -1;
    }
    for (int p : pr) {
      if (i * p >= X) break;
      is_prime[i * p] = false;
      if (i % p == 0) {
        mu[i * p] = 0;
      } else {
        mu[i * p] = -mu[i];
      }
      if (i % p == 0) break;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  init();
  int n, m;
  cin >> n >> m;
  vector<int> l(n), r(n);
  int maxr = 0;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    maxr = max(maxr, r[i]);
  }
  num total = 0;
  for (int g = 1; g <= maxr; g++) {
    if (mu[g] == 0) continue;
    int S = m / g + 1;
    vector<num> dp(S, 0);
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
      int newl = (l[i] + g - 1) / g;
      int newr = r[i] / g;
      vector<num> psum(S + 1, 0);
      for (int x = 0; x < S; x++) psum[x + 1] = psum[x] + dp[x];
      vector<num> ndp(S, 0);
      if (newl <= newr) {
        for (int x = 0; x < S; x++) {
          ndp[x] = psum[max(x - newl + 1, 0)] - psum[max(x - newr, 0)];
        }
      }
      dp = ndp;
    }
    num ans = 0;
    for (num v : dp) ans += v;
    total += ans * mu[g];
  }
  cout << total << '\n';
}

### Prompt

Please formulate 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;
template <int MOD_>
struct modnum {
  static constexpr int MOD = MOD_;
  static_assert(MOD_ > 0, "MOD must be positive");

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

 public:
  modnum() : v(0) {}
  modnum(ll 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) {
    ll 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 += o.v;
    if (v >= MOD) v -= MOD;
    return *this;
  }
  modnum& operator-=(const modnum& o) {
    v -= o.v;
    if (v < 0) v += MOD;
    return *this;
  }
  modnum& operator*=(const modnum& o) {
    v = int(ll(v) * ll(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;
  }
};
template <typename T>
T pow(T a, long long b) {
  assert(b >= 0);
  T r = 1;
  while (b) {
    if (b & 1) r *= a;
    b >>= 1;
    a *= a;
  }
  return r;
}
using num = modnum<998244353>;
const int X = 2.1e5;
bitset<X> is_prime;
vector<int> pr;
vector<int> mu(X, 0);
void init() {
  is_prime.flip();
  is_prime[0] = is_prime[1] = false;
  mu[1] = 1;
  for (int i = 2; i < X; i++) {
    if (is_prime[i]) {
      pr.push_back(i);
      mu[i] = -1;
    }
    for (int p : pr) {
      if (i * p >= X) break;
      is_prime[i * p] = false;
      if (i % p == 0) {
        mu[i * p] = 0;
      } else {
        mu[i * p] = -mu[i];
      }
      if (i % p == 0) break;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  init();
  int n, m;
  cin >> n >> m;
  vector<int> l(n), r(n);
  int maxr = 0;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    maxr = max(maxr, r[i]);
  }
  num total = 0;
  for (int g = 1; g <= maxr; g++) {
    if (mu[g] == 0) continue;
    int S = m / g + 1;
    vector<num> dp(S, 0);
    dp[0] = 1;
    for (int i = 0; i < n; i++) {
      int newl = (l[i] + g - 1) / g;
      int newr = r[i] / g;
      vector<num> psum(S + 1, 0);
      for (int x = 0; x < S; x++) psum[x + 1] = psum[x] + dp[x];
      vector<num> ndp(S, 0);
      if (newl <= newr) {
        for (int x = 0; x < S; x++) {
          ndp[x] = psum[max(x - newl + 1, 0)] - psum[max(x - newr, 0)];
        }
      }
      dp = ndp;
    }
    num ans = 0;
    for (num v : dp) ans += v;
    total += ans * mu[g];
  }
  cout << total << '\n';
}

```