#include <bits/stdc++.h>
using namespace std;
int N, L[6], R[6], K;
bool dp[5][5][5];
double DP[5][5][5];
inline double cases(int pos, int val) {
  if (val < L[pos]) return 0.0;
  if (val > R[pos]) val = R[pos];
  return (double)(val - L[pos] + 1);
}
inline double great(int pos, int val) {
  if (val > R[pos]) return 0.0;
  if (val < L[pos]) val = L[pos];
  return (double)(R[pos] - val + 1);
}
double expect(int pos, int same, int big) {
  if (pos >= N) {
    if (big >= 2) return 0.0;
    return (big + same >= 2) ? (double)K : 0.0;
  }
  if (dp[pos][same][big]) return DP[pos][same][big];
  dp[pos][same][big] = true;
  double &res = DP[pos][same][big];
  res = 0.0;
  double S = cases(pos, K - 1), tot = (R[pos] - L[pos] + 1);
  double B = great(pos, K + 1);
  res = (S / tot) * expect(pos + 1, same, big);
  if (K >= L[pos] && K <= R[pos])
    res += (1.0 / tot) * expect(pos + 1, same + 1, big);
  res += (B / tot) * expect(pos + 1, same, big + 1);
  return res;
}
int main() {
  int mi = 5000000, mx = -10000;
  cin >> N;
  for (int i = 0; i < (int)N; i++) {
    cin >> L[i] >> R[i];
    mi = min(L[i], mi);
    mx = max(R[i], mx);
  }
  double ret = 0.0;
  for (int i = mi; i < (int)mx + 1; i++) {
    memset(dp, false, sizeof(dp));
    K = i;
    double tp = expect(0, 0, 0);
    ret += tp;
  }
  printf("%.10lf\n", ret);
}
