#include <bits/stdc++.h>
using namespace std;
struct lsh {
  vector<int> data;
  unordered_map<int, int> mp;
  void append(int x) { data.push_back(x); }
  void fini() {
    sort(data.begin(), data.end());
    data.erase(unique(data.begin(), data.end()), data.end());
    for (int i = 0; i < data.size(); i += 1) {
      mp[data[i]] = i;
    }
  }
  int find(int x) {
    if (mp.find(x) == mp.end())
      return -1;
    else
      return mp[x] + 1;
  }
  int operator[](int x) { return data[x - 1]; }
  unsigned size() { return data.size(); };
} ls;
const int mod = 998244353;
long long qpow(long long x, long long y, const long long& k) {
  long long t = 1;
  while (y) {
    if (y & 1) {
      t = t * x % k;
    }
    x = x * x % k;
    y >>= 1;
  }
  return t;
}
int inv(int x) { return qpow(x, mod - 2, mod); }
struct msp {
  int l, r;
} a[200];
long long f[200][200];
long long y[200][200];
signed main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i += 1) {
    int l, r;
    cin >> l >> r;
    ls.append(l), ls.append(r + 1);
    a[i] = {l, r + 1};
  }
  ls.fini();
  reverse(a + 1, a + n + 1);
  for (int i = 1; i <= n; i += 1) {
    a[i].l = ls.find(a[i].l), a[i].r = ls.find(a[i].r);
  }
  for (int i = 1; i < ls.size(); i += 1) {
    y[i][1] = ls[i + 1] - ls[i];
    for (int j = 2; j <= n; j += 1) {
      y[i][j] = y[i][j - 1] * (ls[i + 1] - ls[i] + j - 1) % mod * inv(j) % mod;
    }
  }
  {
    int i = 0;
    for (int j = 1; j < ls.size(); j += 1) {
      for (int k = 1; k <= n; k += 1) {
        if (a[k].l <= j && a[k].r > j) {
          f[k][j] = y[j][k];
        } else
          break;
      }
    }
  }
  for (int i = 1; i <= n; i += 1) {
    for (int j = a[i].l; j < a[i].r; j += 1) {
      for (int u = j + 1; u < ls.size(); ++u) {
        for (int k = i + 1; k <= n; k += 1) {
          if (a[k].l <= u && a[k].r > u) {
            f[k][u] = (f[k][u] + f[i][j] * y[u][k - i] % mod) % mod;
          } else
            break;
        }
      }
    }
  }
  long long ans = 0;
  for (int j = 1; j < ls.size(); j += 1) {
    (ans += f[n][j]) %= mod;
  }
  long long qs = 1;
  for (int i = 1; i <= n; i += 1) {
    (qs *= ls[a[i].r] - ls[a[i].l]) %= mod;
  }
  cout << ans * inv(qs) % mod << '\n';
  return 0;
}
