#include <bits/stdc++.h>
using namespace std;
const int mo = 998244353;
long long l[111], r[111], s[111], sz[111], a[111][111];
long long qk(long long x, int y) {
  long long r = 1;
  for (; y; y >>= 1) {
    if (y & 1) r = r * x % mo;
    x = x * x % mo;
  }
  return r;
}
long long cal(int n, long long m) {
  long long res = 1;
  for (auto i = (1); i <= (n); ++i)
    res = res * (n + m - i) % mo * qk(i, mo - 2) % mo;
  return res;
}
int main() {
  int n;
  long long sz = 1;
  scanf("%d", &n);
  for (auto i = (1); i <= (n); ++i) {
    scanf("%lld%lld", &l[i], &r[i]);
    s[i * 2 - 1] = l[i];
    s[i * 2] = ++r[i];
    sz = sz * (r[i] - l[i]) % mo;
  }
  sort(s + 1, s + n * 2 + 1);
  int tot = unique(s + 1, s + n * 2 + 1) - (s + 1);
  for (auto i = (1); i <= (n); ++i) {
    l[i] = lower_bound(s + 1, s + tot + 1, l[i]) - s;
    r[i] = lower_bound(s + 1, s + tot + 1, r[i]) - s;
  }
  for (auto i = (1); i <= (tot + 1); ++i) a[0][i] = 1;
  for (auto i = (1); i <= (n); ++i) {
    for (auto j = (l[i]); j <= (r[i] - 1); ++j)
      for (auto k = (i - 1); k >= (0); --k) {
        a[i][j] = (a[i][j] + a[k][j + 1] * cal(i - k, s[j + 1] - s[j])) % mo;
        if (l[k] > j || r[k] <= j) break;
      }
    for (auto j = (tot); j >= (1); --j) a[i][j] = (a[i][j] + a[i][j + 1]) % mo;
  }
  printf("%lld\n", a[n][1] * qk(sz, mo - 2) % mo);
}
