#include <bits/stdc++.h>
using namespace std;
int L[5], R[5];
double doit(int price, int mask, int idx, int n) {
  double ret = price;
  if (idx >= 0) {
    int low = max(price + 1, L[idx]);
    int high = R[idx];
    if (low > high) return 0.0;
    ret *= high - low + 1;
  }
  for (int i = 0; i < n; ++i) {
    if (i == idx || (mask & (1 << i))) continue;
    int high = min(R[i], price - 1);
    int low = L[i];
    if (high < low) return 0.0;
    ret *= high - low + 1;
  }
  return ret;
}
int main() {
  int n;
  cin >> n;
  double total = 1.0;
  for (int i = 0; i < n; ++i) {
    cin >> L[i] >> R[i];
    total *= R[i] - L[i] + 1;
  }
  double sum = 0.0;
  for (int mask = 1; mask < (1 << n); ++mask) {
    vector<int> A;
    for (int i = 0; i < n; ++i) {
      if (mask & (1 << i)) A.push_back(i);
    }
    int minR = R[A[0]], maxL = L[A[0]];
    for (auto& idx : A) {
      minR = min(minR, R[idx]);
      maxL = max(maxL, L[idx]);
    }
    if (maxL > minR) continue;
    for (int i = 0; i < n; ++i) {
      if (mask & (1 << i)) continue;
      for (int k = maxL; k <= minR; ++k) {
        sum += doit(k, mask, i, n);
      }
    }
    if (A.size() > 1) {
      for (int k = maxL; k <= minR; ++k) {
        sum += doit(k, mask, -1, n);
      }
    }
  }
  sum /= total;
  printf("%.10f\n", sum);
  return 0;
}
