#include <bits/stdc++.h>
using namespace std;
const int maxn = 150;
long long l[maxn], r[maxn];
long long tmp[maxn], f[maxn][maxn];
const long long mod = 998244353;
int fast_pow(int a, int x) {
  int ans = 1;
  for (; x; x >>= 1, a = 1ll * a * a % mod)
    if (x & 1) ans = 1ll * ans * a % mod;
  return ans;
}
int C(int x, int y) {
  int ans = 1;
  for (int i = 1; i <= x; i++)
    ans = 1ll * ans * (y + 1 - i) % mod * fast_pow(i, mod - 2) % mod;
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  int dn = 0;
  long long sum = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &l[i], &r[i]);
    r[i]++;
    tmp[++dn] = l[i];
    tmp[++dn] = r[i];
    sum = sum * (long long)(r[i] - l[i]) % mod;
  }
  sort(tmp + 1, tmp + 1 + dn);
  dn = unique(tmp + 1, tmp + 1 + dn) - tmp - 1;
  for (int i = 1; i <= n; i++) {
    l[i] = lower_bound(tmp + 1, tmp + 1 + dn, l[i]) - tmp;
    r[i] = lower_bound(tmp + 1, tmp + 1 + dn, r[i]) - tmp;
  }
  for (int i = 1; i <= dn; i++) f[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = l[i]; j < r[i]; j++) {
      for (int k = i; k >= 1; k--) {
        if (l[k] > j || j >= r[k]) break;
        f[i][j] =
            (f[i][j] + f[k - 1][j + 1] *
                           C(i - k + 1, tmp[j + 1] - tmp[j] - k + i) % mod) %
            mod;
      }
    }
    for (int j = dn - 1; j >= 1; j--) {
      f[i][j] = (f[i][j] + f[i][j + 1]) % mod;
    }
  }
  printf("%lld\n", 1ll * f[n][1] * fast_pow(sum, mod - 2) % mod);
}
