#include <bits/stdc++.h>
using namespace std;
struct inter {
  long long st, dr;
} v[100005];
long long tot[10005], imp[205], comb[205][205], dp0[205], dp1[205];
long long po(long long b, long long e) {
  long long p = 1;
  while (e) {
    if (e % 2 == 1) p = p * b % 998244353;
    b = b * b % 998244353;
    e = e / 2;
  }
  return p;
}
int main() {
  long long n, i, len, j, k, u = 0;
  scanf("%lld", &n);
  imp[0] = 1;
  for (i = 1; i <= n; i++) {
    scanf("%lld%lld", &v[i].st, &v[i].dr);
    imp[i] = po(i, 998244353 - 2);
    tot[++u] = v[i].st;
    tot[++u] = ++v[i].dr;
  }
  sort(tot + 1, tot + u + 1);
  u = unique(tot + 1, tot + u + 1) - (tot + 1);
  for (i = 1; i <= n; i++)
    v[i].st = lower_bound(tot + 1, tot + u + 1, v[i].st) - tot;
  for (i = 1; i <= n; i++)
    v[i].dr = lower_bound(tot + 1, tot + u + 1, v[i].dr) - tot;
  dp0[0] = 1;
  for (i = u - 1; i >= 1; i--) {
    len = tot[i + 1] - tot[i];
    comb[i][0] = 1;
    for (j = 1; j <= n; j++)
      comb[i][j] =
          comb[i][j - 1] * (len + j - 1) % 998244353 * imp[j] % 998244353;
    for (j = 1; j <= n; j++) {
      dp1[j] = dp0[j];
      for (k = j - 1; k >= 0; k--)
        if (v[k + 1].st <= i && v[k + 1].dr > i)
          dp1[j] = (dp1[j] + dp0[k] * comb[i][j - k] % 998244353) % 998244353;
        else
          break;
    }
    for (j = 1; j <= n; j++) dp0[j] = dp1[j];
  }
  long long rasp = dp0[n];
  for (i = 1; i <= n; i++)
    rasp = rasp * po(tot[v[i].dr] - tot[v[i].st], 998244353 - 2) % 998244353;
  printf("%lld\n", rasp);
  return 0;
}
