#include <bits/stdc++.h>
using namespace std;
const int N = 105, P = 998244353;
int n, hc;
int al[N], ar[N], h[N], inv[N], cm[N], f[N][N], sf[N][N];
void m1(int &x) {
  if (x >= P) x -= P;
}
int ksm(int a, int b) {
  int x = 1;
  for (; b; b & 1 ? x = 1ll * x * a % P : 0, a = 1ll * a * a % P, b >>= 1)
    ;
  return x;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &al[i], &ar[i]), h[++hc] = al[i], h[++hc] = ++ar[i];
  sort(h + 1, h + hc + 1);
  hc = unique(h + 1, h + hc + 1) - (h + 1);
  for (int i = 1; i <= n; i++)
    al[i] = lower_bound(h + 1, h + hc + 1, al[i]) - h,
    ar[i] = lower_bound(h + 1, h + hc + 1, ar[i]) - h;
  inv[1] = 1;
  for (int i = 2; i <= n; i++) inv[i] = 1ll * inv[P % i] * (P - P / i) % P;
  for (int i = 1; i <= hc; i++) sf[0][i] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = al[i]; j < ar[i]; j++) {
      int l = h[j + 1] - h[j];
      cm[0] = 1;
      for (int k = 1; k <= n; k++)
        cm[k] = 1ll * cm[k - 1] * (l + k - 1) % P * inv[k] % P;
      for (int k = i - 1; k >= 0; k--) {
        if (!(al[k + 1] <= j && j < ar[k + 1])) break;
        f[i][j] = (f[i][j] + 1ll * sf[k][j + 1] * cm[i - k]) % P;
      }
    }
    for (int j = hc - 1; j >= 1; j--) m1(sf[i][j] = sf[i][j + 1] + f[i][j]);
  }
  int Q = 1;
  for (int i = 1; i <= n; i++) Q = 1ll * Q * (h[ar[i]] - h[al[i]]) % P;
  printf("%d\n", 1ll * sf[n][1] * ksm(Q, P - 2) % P);
  return 0;
}
