#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout << setiosflags(ios::fixed) << setprecision(10);
  const int m = 10001;
  int n;
  cin >> n;
  vector<int> l(n), r(n), a(n);
  for (int i = 0; i < n; ++i) {
    cin >> l[i] >> r[i];
    a[i] = i;
  }
  double answer = 0.0;
  do {
    int prev = -1;
    vector<double> dp(m);
    dp[0] = 1.0;
    for (int i = 0; i + 1 < n; ++i) {
      const int k = a[i];
      const double p = 1.0 / (r[k] + 1 - l[k]);
      vector<double> next(m);
      double sum = 0.0;
      for (int j = 0; j < m; ++j) {
        if (prev < k) {
          sum += dp[j];
        }
        if (l[k] <= j && j <= r[k]) {
          next[j] = sum * p;
        }
        if (prev >= k) {
          sum += dp[j];
        }
      }
      dp.swap(next);
      prev = k;
    }
    const int k = a[n - 1];
    for (int j = 0; j <= r[k]; ++j) {
      const int nume = r[k] + 1 - max(l[k], j + (prev < k ? 0 : 1));
      const int deno = r[k] + 1 - l[k];
      const double p = static_cast<double>(nume) / deno;
      answer += j * dp[j] * p;
    }
  } while (next_permutation(a.begin(), a.end()));
  cout << answer << endl;
  return 0;
}
