#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long z = 1;
int f[205][205], s[205][205], l[205], r[205], x[205], inv[205], tot[205], cnt;
int ksm(int a, int b, int p) {
  int s = 1;
  while (b) {
    if (b & 1) s = z * s * a % p;
    a = z * a * a % p;
    b >>= 1;
  }
  return s;
}
int C(int n, int m) {
  int i, x = inv[m];
  for (i = n; i >= n - m + 1; i--) x = z * x * i % mod;
  return x;
}
int main() {
  int i, j, n, m, k, ans = 0, len, invq = 1;
  scanf("%d", &n);
  for (i = n; i >= 1; i--) {
    scanf("%d%d", &l[i], &r[i]);
    x[++cnt] = l[i], x[++cnt] = r[i] + 1;
    invq = z * invq * ksm(r[i] - l[i] + 1, mod - 2, mod) % mod;
  }
  sort(x + 1, x + cnt + 1);
  m = unique(x + 1, x + cnt + 1) - x - 1;
  for (k = i = 1; i <= n; i++) k = z * k * i % mod;
  inv[n] = ksm(k, mod - 2, mod);
  for (i = n - 1; i >= 0; i--) inv[i] = z * (i + 1) * inv[i + 1] % mod;
  for (i = 1; i <= n; i++) {
    l[i] = lower_bound(x + 1, x + m + 1, l[i]) - x;
    r[i] = lower_bound(x + 1, x + m + 1, r[i] + 1) - x - 1;
  }
  for (i = 0; i <= m; i++) s[0][i] = 1;
  for (i = 1; i <= n; i++) {
    for (j = l[i]; j <= r[i]; j++) {
      for (k = i - 1; k >= 0; k--) {
        if (l[k + 1] > j || r[k + 1] < j) break;
        len = x[j + 1] - x[j];
        f[i][j] =
            (f[i][j] + z * s[k][j - 1] * C(len + i - k - 1, i - k) % mod) % mod;
      }
    }
    for (j = 1; j <= m; j++) s[i][j] = (s[i][j - 1] + f[i][j]) % mod;
  }
  for (i = l[n]; i <= r[n]; i++) ans = (ans + f[n][i]) % mod;
  ans = z * ans * invq % mod;
  printf("%d", ans);
  return 0;
}
