#include <bits/stdc++.h>
using namespace std;
long long n, l[110], r[110], s[110];
long long b[110], tot;
long long qpow(long long x, long long y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x % 998244353)
    if (y & 1) ret = ret * x % 998244353;
  return ret;
}
long long C(long long x, long long y) {
  long long ret = 1;
  for (long long i = x; i >= x - y + 1; i--) ret = ret * i % 998244353;
  for (long long i = y; i; i--) ret = ret * qpow(i, 998244353 - 2) % 998244353;
  return ret;
}
long long f[110][110];
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld%lld", &l[i], &r[i]);
    r[i]++;
    b[++tot] = l[i];
    b[++tot] = r[i];
    s[i] = r[i] - l[i];
  }
  sort(b + 1, b + tot + 1);
  tot = unique(b + 1, b + tot + 1) - b - 1;
  for (long long i = 1; i <= n; i++) {
    l[i] = lower_bound(b + 1, b + tot + 1, l[i]) - b;
    r[i] = lower_bound(b + 1, b + tot + 1, r[i]) - b;
  }
  f[0][tot] = 1;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j < tot; j++)
      for (long long k = i - 1; k >= 0; k--) {
        if (!(l[k + 1] <= j && j + 1 <= r[k + 1])) break;
        long long now = 0;
        for (long long t = j + 1; t <= tot; t++)
          now = (now + f[k][t]) % 998244353;
        now = now * C(b[j + 1] - b[j] - 1 + i - k, i - k) % 998244353;
        f[i][j] = (f[i][j] + now) % 998244353;
      }
  long long ans = 0;
  for (long long i = 1; i < tot; i++) ans = (ans + f[n][i]) % 998244353;
  for (long long i = 1; i <= n; i++)
    ans = ans * qpow(s[i], 998244353 - 2) % 998244353;
  printf("%lld", ans);
  return 0;
}
