#include <bits/stdc++.h>
using namespace std;
long long qpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * a % (998244353);
    a = a * a % (998244353);
    n >>= 1;
  }
  return res;
}
int n, cnt;
int a[105], b[105], tmp[105];
long long C[105], g[105], inv[105];
void init() {
  inv[1] = 1;
  for (int i = 2; i <= n; i++) {
    inv[i] =
        ((998244353) - (998244353) / i) * inv[(998244353) % i] % (998244353);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    tmp[++cnt] = a[i], tmp[++cnt] = ++b[i];
  }
  sort(tmp + 1, tmp + cnt + 1);
  cnt = unique(tmp + 1, tmp + cnt + 1) - tmp - 1;
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(tmp + 1, tmp + cnt + 1, a[i]) - tmp;
    b[i] = lower_bound(tmp + 1, tmp + cnt + 1, b[i]) - tmp;
  }
}
int main() {
  cin >> n;
  init();
  C[0] = g[0] = 1;
  for (int j = cnt - 1; j >= 1; j--) {
    int l = tmp[j + 1] - tmp[j];
    for (int i = 1; i <= n; i++) {
      C[i] = C[i - 1] * (l + i - 1) % (998244353) * inv[i] % (998244353);
    }
    for (int i = n; i >= 1; i--) {
      if (a[i] > j || b[i] <= j) continue;
      int m = 1;
      for (int k = i - 1; k >= 0; k--) {
        g[i] = (g[i] + C[m] * g[k] % (998244353)) % (998244353);
        if (a[k] > j || b[k] <= j) break;
        m++;
      }
    }
  }
  long long ans = g[n], t = 1;
  for (int i = 1; i <= n; i++) {
    t = t * (tmp[b[i]] - tmp[a[i]]) % (998244353);
  }
  ans = (ans * qpow(t, (998244353) - 2)) % (998244353);
  cout << ans << endl;
  return 0;
}
