#include <bits/stdc++.h>
using namespace std;
int L[6], R[6];
int N;
double memo[10011][3][2][6];
bool vis[10011][3][2][6];
double getCount(int amt, int eq, int boro, int n) {
  if (!n) {
    if (eq == 0) return 0;
    if (eq == 1 && !boro) return 0;
    return 1;
  }
  if (vis[amt][eq][boro][n]) return memo[amt][eq][boro][n];
  double rv = 0;
  double choto = (min(R[n - 1], amt - 1)) - min(L[n - 1], amt - 1) + 1;
  if (L[n - 1] >= amt) choto = 0;
  rv += choto * getCount(amt, eq, boro, n - 1);
  if (L[n - 1] <= amt && R[n - 1] >= amt)
    rv += getCount(amt, min(2, eq + 1), boro, n - 1);
  if (!boro && R[n - 1] > amt) {
    double boro = R[n - 1] - max(amt, L[n - 1] - 1);
    rv += boro * getCount(amt, eq, 1, n - 1);
  }
  return memo[amt][eq][boro][n] = rv;
}
int main() {
  while (cin >> N) {
    for (int i = 0; i < N; i++) cin >> L[i] >> R[i];
    memset(vis, 0, sizeof vis);
    double tot = 1;
    for (int i = 0; i < N; i++) tot *= (R[i] - L[i] + 1);
    double rv = 0;
    double Psum = 0;
    for (int amt = 1; amt <= 10000; amt++) {
      double P = getCount(amt, 0, 0, N) / tot;
      rv += P * amt;
      Psum += P;
    }
    printf("%.18f\n", rv);
  }
}
