#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e2 + 2, MOD = 998244353;
int n, ans = 1;
int l[MAX_N], r[MAX_N];
int indL[MAX_N], indR[MAX_N];
int sz[MAX_N];
int dp[MAX_N][MAX_N];
int F[MAX_N];
int Fdiv[MAX_N];
vector<int> vec;
int _sum(int a, int b) {
  int c = a + b;
  if (MOD <= c) c -= MOD;
  return c;
}
int _mul(int a, int b) {
  int c = 1LL * a * b % MOD;
  return c;
}
int _pow(int a, int b) {
  int res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = _mul(res, a);
    a = _mul(a, a);
  }
  return res;
}
int _choose(int a, int b) {
  a = min(a, b - a);
  int res = Fdiv[a];
  for (int i = b; b - a < i; i--) res = _mul(res, i);
  return res;
}
void preProcess() {
  F[0] = Fdiv[0] = 1;
  for (int i = 1; i < MAX_N; i++) {
    F[i] = _mul(i, F[i - 1]);
    Fdiv[i] = _pow(F[i], MOD - 2);
  }
}
int main() {
  preProcess();
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    r[i]++;
    ans = _mul(ans, r[i] - l[i]);
    vec.push_back(l[i]);
    vec.push_back(r[i]);
  }
  sort(vec.begin(), vec.end());
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  for (int i = 0; i + 1 < vec.size(); i++) sz[i] = vec[i + 1] - vec[i];
  for (int i = 1; i <= n; i++) {
    indL[i] = lower_bound(vec.begin(), vec.end(), l[i]) - vec.begin();
    indR[i] = lower_bound(vec.begin(), vec.end(), r[i]) - vec.begin();
  }
  for (int i = 0; i < vec.size(); i++) dp[0][i] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = indR[i] - 1; ~j; j--) {
      dp[i][j] = dp[i][j + 1];
      for (int k = i; k; k--) {
        if (indR[k] <= j || j < indL[k]) break;
        dp[i][j] = _sum(dp[i][j], _mul(dp[k - 1][j + 1],
                                       _choose(i - k + 1, sz[j] + i - k)));
      }
    }
  cout << _mul(dp[n][0], _pow(ans, MOD - 2)) << "\n";
  return 0;
}
