#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 5, mod = 998244353;
int n, t[N], m, l[N], r[N], rev[N], fact[N], dp[N][N], inv[N];
int sum(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
int mult(int a, int b) { return 1LL * a * b % mod; }
int pw(int a, int b) {
  if (!b) return 1;
  int ans = pw(a, b / 2);
  ans = mult(ans, ans);
  if (b & 1) ans = mult(ans, a);
  return ans;
}
void prep() {
  vector<int> vec;
  for (int i = 0; i < n; 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());
  m = vec.size();
  for (int i = 0; i < m; i++) t[i] = vec[i];
  for (int i = 0; i < n; i++) {
    l[i] = lower_bound(t, t + m, l[i]) - t;
    r[i] = lower_bound(t, t + m, r[i]) - t;
  }
  fact[0] = 1;
  for (int i = 1; i < N; i++) fact[i] = mult(fact[i - 1], i);
  rev[N - 1] = pw(fact[N - 1], mod - 2);
  for (int i = N - 2; ~i; i--) rev[i] = mult(rev[i + 1], i + 1);
  for (int i = 1; i < N - 1; i++) inv[i] = mult(fact[i - 1], rev[i]);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  int ans = 1;
  for (int i = n - 1; ~i; i--) {
    cin >> l[i] >> r[i];
    r[i]++;
  }
  for (int i = 0; i < n; i++) ans = mult(ans, r[i] - l[i]);
  prep();
  dp[0][0] = 1;
  for (int j = 1; j < m; j++) {
    dp[0][j] = 1;
    for (int i = 0; i < n; i++) {
      dp[i + 1][j] = dp[i + 1][j - 1];
      if (l[i] >= j || r[i] < j) continue;
      int len = t[j] - t[j - 1];
      int comb = 1, cnt = 0;
      for (int k = i; ~k; k--) {
        if (l[k] < j && r[k] >= j) {
          comb = mult(comb, sum(len, cnt));
          comb = mult(comb, inv[cnt + 1]);
          dp[i + 1][j] = sum(dp[i + 1][j], mult(comb, dp[k][j - 1]));
          cnt++;
        } else
          break;
      }
    }
  }
  cout << mult(dp[n][m - 1], pw(ans, mod - 2)) << "\n";
}
