#include <bits/stdc++.h>
using namespace std;
const int N = 107;
const int mod = 998244353;
int qpow(int x, int y = mod - 2) {
  int res = 1;
  for (; y; x = (long long)x * x % mod, y >>= 1)
    if (y & 1) res = (long long)res * x % mod;
  return res;
}
int n, m, l[N], r[N], f[N], tot, fl[N], fr[N], ans;
int dp[N][N], s[N][N], g[N][N];
int inv[N], fac[N], ifac[N];
void init(int x) {
  inv[1] = 1;
  for (int i = 2, iE = x; i <= iE; i++)
    inv[i] = (long long)(mod - mod / i) * inv[mod % i] % mod;
  fac[0] = ifac[0] = 1;
  for (int i = 1, iE = x; i <= iE; i++)
    fac[i] = (long long)fac[i - 1] * i % mod,
    ifac[i] = (long long)ifac[i - 1] * inv[i] % mod;
}
int C(int x, int y) {
  return (long long)fac[x] * ifac[y] % mod * ifac[x - y] % mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n, init(n << 1 | 1);
  for (int i = n, iE = 1; i >= iE; i--)
    cin >> l[i] >> r[i], ++r[i], f[++tot] = l[i], f[++tot] = r[i];
  sort(f + 1, f + tot + 1);
  tot = unique(f + 1, f + tot + 1) - f - 1;
  for (int i = 1, iE = n; i <= iE; i++)
    fl[i] = lower_bound(f + 1, f + tot + 1, l[i]) - f,
    fr[i] = lower_bound(f + 1, f + tot + 1, r[i]) - f - 1;
  for (int i = 1, iE = tot - 1; i <= iE; i++) {
    int res = 1;
    for (int j = 0, jE = n; j <= jE; j++)
      g[i][j] = res,
      res = (long long)res * inv[j + 1] % mod * (f[i + 1] - f[i] + j) % mod;
  }
  dp[0][0] = 1;
  for (int i = 0, iE = tot - 1; i <= iE; i++) s[0][i] = 1;
  for (int i = 1, iE = n; i <= iE; i++) {
    for (int j = 1, jE = tot - 1; j <= jE; j++)
      if (fl[i] <= j && j <= fr[i]) {
        for (int a = i - 1, aE = 0; a >= aE; a--)
          if (fl[a + 1] <= j && j <= fr[a + 1])
            (dp[i][j] += (long long)s[a][j - 1] * g[j][i - a] % mod) %= mod;
          else
            break;
      }
    for (int j = 1, jE = tot - 1; j <= jE; j++)
      s[i][j] = (s[i][j - 1] + dp[i][j]) % mod;
  }
  for (int i = 1, iE = tot - 1; i <= iE; i++) (ans += dp[n][i]) %= mod;
  for (int i = 1, iE = n; i <= iE; i++)
    ans = (long long)ans * qpow(r[i] - l[i]) % mod;
  cout << ans << endl;
  return 0;
}
