#include <bits/stdc++.h>
using namespace std;
double get(int l, int r, int x) { return 1.0 * (x - l + 1) / (r - l + 1); }
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> l(n), r(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  double ans = 0;
  for (int win = 1; win < (1 << n); win++) {
    if (__builtin_popcount(win) >= 2) {
      for (int secondBest = 1; secondBest <= 10000; secondBest++) {
        double prob = 1;
        bool can = true;
        for (int i = 0; i < n; i++) {
          if (~win & (1 << i)) {
            if (l[i] >= secondBest) {
              can = false;
              break;
            }
            prob *= get(l[i], r[i], min(secondBest - 1, r[i]));
          } else {
            if (l[i] > secondBest || r[i] < secondBest) {
              can = false;
              break;
            }
            prob *= 1.0 / (r[i] - l[i] + 1);
          }
        }
        if (can) {
          ans += 1.0 * prob * secondBest;
        }
      }
    }
  }
  for (int win = 0; win < n; win++) {
    for (int secondBest = 1; secondBest <= 10000; secondBest++) {
      if (r[win] <= secondBest) break;
      for (int nmask = 1; nmask < (1 << n); nmask++) {
        if (nmask & (1 << win)) continue;
        double prob = 1;
        bool can = true;
        for (int i = 0; i < n; i++) {
          if (nmask & (1 << i)) {
            if (r[i] < secondBest || l[i] > secondBest) {
              can = false;
              break;
            } else {
              prob *= 1.0 / (r[i] - l[i] + 1);
            }
          } else if (i != win) {
            if (l[i] >= secondBest) {
              can = false;
              break;
            } else {
              prob *= get(l[i], r[i], min(secondBest - 1, r[i]));
            }
          }
        }
        if (can) {
          ans += 1.0 * (r[win] - max(l[win], secondBest + 1) + 1) /
                 (r[win] - l[win] + 1) * prob * secondBest;
        }
      }
    }
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
