#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
inline long long mod(long long x_) { return (x_) % MOD; }
long long modpow(long long x_, long long N_) {
  if (N_ == 0) return 1;
  long long a = modpow(x_, N_ / 2);
  a = (a * a) % MOD;
  if (N_ % 2) a = (a * x_) % MOD;
  return a;
}
long long inv(long long x_) { return modpow(x_, MOD - 2); }
class mi {
 public:
  mi(long long v = 0) { value = v; }
  mi operator+(long long rs) { return mod(value + rs); }
  mi operator-(long long rs) { return mod(value - rs + MOD); }
  mi operator*(long long rs) { return mod(value * rs); }
  mi operator/(long long rs) { return mod(value * inv(rs)); }
  mi& operator+=(long long rs) {
    *this = (*this) + rs;
    return *this;
  }
  mi& operator-=(long long rs) {
    *this = (*this) - rs;
    return *this;
  }
  mi& operator*=(long long rs) {
    *this = (*this) * rs;
    return *this;
  }
  mi& operator/=(long long rs) {
    *this = (*this) / rs;
    return *this;
  }
  operator long long&() { return value; }
  long long value;
};
void program();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  program();
}
const int MX = 200;
int n, l[MX], r[MX], m = 0;
int lSeg[MX], rSeg[MX];
set<int> segPoints;
int segBeg[MX];
mi dp[MX][MX];
mi bico(mi n, mi k) {
  if (k == 0) return 1;
  return bico(n, k - mi(1)) * mi(n - k + mi(1)) / k;
}
mi getAns(int i, int j) {
  if (dp[i][j] == -1) {
    if (i == 0) return dp[i][j] = 1;
    if (j == 0) return dp[i][j] = 0;
    mi ans = getAns(i, j - 1);
    for (int k = int(1); k < int(i + 1); k++) {
      if (lSeg[i - k] >= m - j || rSeg[i - k] < m - j) break;
      ans += getAns(i - k, j - 1) *
             bico(segBeg[m - j] - segBeg[m - j - 1] + k - 1, k);
    }
    dp[i][j] = ans;
  }
  return dp[i][j];
}
void program() {
  cin >> n;
  for (int i = int(0); i < int(n); i++) cin >> l[i] >> r[i], r[i]++;
  for (int i = int(0); i < int(n); i++)
    segPoints.insert(l[i]), segPoints.insert(r[i]);
  for (int i : segPoints) segBeg[m++] = i;
  for (int i = int(0); i < int(MX); i++)
    for (int j = int(0); j < int(MX); j++) dp[i][j] = -1;
  for (int i = int(0); i < int(n); i++) {
    for (int j = int(0); j < int(m); j++) {
      if (segBeg[j] == l[i]) lSeg[i] = j;
      if (segBeg[j] == r[i]) rSeg[i] = j;
    }
  }
  mi correct = getAns(n, m - 1);
  mi total = 1;
  for (int i = int(0); i < int(n); i++) total *= mi(r[i] - l[i]);
  cout << correct / total << endl;
}
