#include <bits/stdc++.h>
using namespace std;
const int max_n = 105;
const int mod = 998244353;
inline int Add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
inline int Sub(int x, int y) { return (x -= y) >= 0 ? x : x + mod; }
inline int Mul(int x, int y) { return 1ll * x * y % mod; }
inline int Pow(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) res = 1ll * res * x % mod;
    y >>= 1;
    x = 1ll * x * x % mod;
  }
  return res;
}
int inv[max_n];
int C(int n, int m) {
  int res = 1;
  for (int i = 0; i < m; i++) res = Mul(res, n - i), res = Mul(res, inv[i + 1]);
  return res;
}
int S(int n, int m) { return C(n + m - 1, m); }
int n, l[max_n], r[max_n];
int dp[max_n][max_n], sum[max_n];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", l + i, r + i), r[i]++;
  vector<int> lsh;
  for (int i = 1; i <= n; i++) lsh.push_back(l[i]), lsh.push_back(r[i]);
  sort(lsh.begin(), lsh.end());
  lsh.erase(unique(lsh.begin(), lsh.end()), lsh.end());
  int tot = lsh.size() - 1;
  for (int i = 1; i <= n / 2; i++)
    swap(l[i], l[n + 1 - i]), swap(r[i], r[n + 1 - i]);
  inv[1] = 1;
  for (int i = 2; i < max_n; i++) inv[i] = Mul(inv[mod % i], mod - mod / i);
  dp[0][1] = 1;
  sum[0] = 1;
  for (int j = 1; j <= tot; j++) sum[j] = Add(sum[j], sum[j - 1]);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= tot; j++) {
      int x = lsh[j - 1], y = lsh[j];
      if (l[i] >= y || r[i] <= x)
        for (int k = i; k >= 0; k--) dp[j][k] = 0;
      else {
        for (int k = i; k >= 2; k--)
          dp[j][k] = Mul(dp[j][k - 1], Mul(y - x + k - 1, inv[k]));
        dp[j][1] = Mul(sum[j - 1], y - x);
        dp[j][0] = 0;
      }
    }
    sum[0] = 0;
    for (int j = 1; j <= tot; j++) {
      sum[j] = 0;
      for (int k = 0; k <= i; k++) sum[j] = Add(sum[j], dp[j][k]);
      sum[j] = Add(sum[j], sum[j - 1]);
    }
  }
  int ans = 0;
  for (int j = 1; j <= tot; j++) {
    for (int k = 0; k <= n; k++) ans = Add(ans, dp[j][k]);
  }
  int all = 1;
  for (int i = 1; i <= n; i++) all = Mul(all, r[i] - l[i]);
  ans = Mul(ans, Pow(all, mod - 2));
  printf("%d\n", ans);
  return 0;
}
