#include <bits/stdc++.h>
using namespace std;
int n;
int L[5], R[5];
double notmore(int L, int R, int price) {
  return price < L ? 0 : min(price - L + 1, R - L + 1) / double(R - L + 1);
}
double atleast(int L, int R, int price) {
  return price > R ? 0 : min(R - price + 1, R - L + 1) / double(R - L + 1);
}
double exactly(int L, int R, int price) {
  return price >= L && price <= R ? 1. / (R - L + 1) : 0;
}
int main() {
  double res = 0;
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) {
    cin >> L[i] >> R[i];
  }
  for (int price = (1); price < (int)(10001); ++price) {
    double p = 0;
    for (int over = 0; over < (int)(n); ++over) {
      double pbelow = 1, pexact = 1;
      for (int i = 0; i < (int)(n); ++i) {
        if (i == over) {
          double mul = atleast(L[i], R[i], price + 1);
          pbelow *= mul;
          pexact *= mul;
        } else {
          pbelow *= notmore(L[i], R[i], price - 1);
          pexact *= notmore(L[i], R[i], price);
        }
      }
      p += pexact - pbelow;
    }
    for (int mask = 0; mask < (int)(1 << n); ++mask) {
      int cnt = 0;
      double pp = 1;
      for (int i = 0; i < (int)(n); ++i) {
        if (mask & (1 << i)) {
          ++cnt;
          pp *= exactly(L[i], R[i], price);
        } else
          pp *= notmore(L[i], R[i], price - 1);
      }
      if (cnt > 1) p += pp;
    }
    res += price * p;
  }
  cout.precision(12);
  cout << fixed << res << endl;
  return 0;
}
