#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
long long mpow(long long a, long long x) {
  if (x == 0) return 1;
  long long t = mpow(a, x >> 1);
  if (x % 2 == 0) return t * t % MOD;
  return t * t % MOD * a % MOD;
}
long long inv[10002];
long long C(long long A, long long B) {
  long long ans = 1;
  for (long long i = A; i > A - B; i--) ans = ans * i % MOD;
  for (long long i = 1; i <= B; i++) ans = ans * inv[i] % MOD;
  return ans;
}
long long cac(long long L, long long R, long long k) { return C(R - L + k, k); }
long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }
const int N = 202;
long long dp[N][N << 1], w[N][N << 1], l[N], r[N];
int n;
vector<long long> v;
int main() {
  for (int i = 0; i <= 10000; i++) inv[i] = mpow(i, MOD - 2);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &l[n + 1 - i], &r[n + 1 - i]);
    v.push_back(l[n + 1 - i]);
    v.push_back(r[n + 1 - i] + 1);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  memset(dp, 0, sizeof(dp));
  memset(w, 0, sizeof(w));
  dp[0][0] = 0;
  w[0][0] = 1;
  for (int i = 0; i <= n; i++) {
    for (int x1 = 0; x1 < v.size(); x1++) {
      for (int x2 = x1 + 1; x2 < v.size(); x2++) {
        for (int j = i + 1; j <= n; j++) {
          if (!(l[j] <= v[x2 - 1] && r[j] >= v[x2] - 1)) break;
          long long ways = cac(v[x2 - 1], v[x2] - 1, j - i) % MOD;
          (w[j][x2] += w[i][x1] * ways % MOD) %= MOD;
        }
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= v.size(); i++) ans = (ans + w[n][i]) % MOD;
  int cc = 0, kk = 0;
  for (int i = 42; i <= 1337; i++)
    for (int j = 13; j <= 420; j++) {
      if (i <= j) cc++;
      kk++;
    }
  long long all = 1;
  for (int i = 1; i <= n; i++) all = all * (r[i] - l[i] + 1) % MOD;
  cout << (long long)ans * mpow(all, MOD - 2) % MOD << endl;
}
