#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l[5], r[5];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> l[i] >> r[i];
  vector<int> a;
  for (int i = 0; i < n; i++) a.push_back(i);
  double res = 0;
  double cnt = 0;
  do {
    for (int w = l[a[1]]; w <= r[a[1]]; w++) {
      double q = 1;
      if (r[a[0]] < w || r[a[0]] == w && a[1] < a[0]) continue;
      if (l[a[0]] <= w) {
        if (a[0] < a[1])
          q *= r[a[0]] - w + 1;
        else
          q *= r[a[0]] - w;
      } else
        q *= r[a[0]] - l[a[0]] + 1;
      for (int k = 2; k < n; k++) {
        if (l[a[k]] > w || l[a[k]] == w && a[k] < a[1]) {
          q = 0;
          break;
        }
        if (w <= r[a[k]]) {
          if (a[1] < a[k])
            q *= w - l[a[k]] + 1;
          else
            q *= w - l[a[k]];
        } else
          q *= r[a[k]] - l[a[k]] + 1;
      }
      res += w * q;
      cnt += q;
    }
  } while (next_permutation(a.begin(), a.end()));
  cout << fixed << setprecision(9) << 1.0 * res / cnt;
}
