#include <bits/stdc++.h>
using namespace std;
using namespace std;
int n, m, l[205], r[205], dp[205][205], ls[205];
inline void add(int &a, int b) {
  a += b;
  if (a >= 998244353) a -= 998244353;
}
inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += 998244353;
}
inline int inv(int a, int p) {
  return a == 1 ? 1 : p - 1ll * p * inv(p % a, a) / a;
}
int main() {
  int ans, len;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", l + i, r + i);
    ++r[i];
    ls[m++] = l[i];
    ls[m++] = r[i];
  }
  sort(ls, ls + m);
  m = unique(ls, ls + m) - ls;
  for (int i = 1; i <= n; ++i) {
    l[i] = lower_bound(ls, ls + m, l[i]) - ls;
    r[i] = lower_bound(ls, ls + m, r[i]) - ls;
  }
  for (int i = 0; i <= m; ++i) dp[0][i] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (l[i] > j || r[i] <= j) continue;
      ans = 1;
      len = ls[j + 1] - ls[j];
      for (int k = i; k; --k) {
        if (l[k] > j || r[k] <= j) break;
        ans = 1ll * ans * (len + i - k) % 998244353 *
              inv(i - k + 1, 998244353) % 998244353;
        add(dp[i][j], 1ll * ans * dp[k - 1][j + 1] % 998244353);
      }
    }
    for (int j = m; j; --j) add(dp[i][j - 1], dp[i][j]);
  }
  ans = dp[n][0];
  for (int i = 1; i <= n; ++i) {
    ans = 1ll * ans * inv(ls[r[i]] - ls[l[i]], 998244353) % 998244353;
  }
  printf("%d\n", ans);
}
