#include <bits/stdc++.h>
using namespace std;
const int nm = 7;
const int mm = 10002;
const double eps = 1e-9;
int n, l[nm], r[nm];
double f[nm][2][3];
int x;
double dp(int i, int j, int k) {
  double &res = f[i][j][k];
  if (res > -eps) return res;
  if (i == 0) {
    if (j == 0 && k == 0) return 1.0;
    return 0.0;
  }
  res = 0;
  if (r[i] > x && j) {
    res += double(r[i] - max(x + 1, l[i]) + 1) / double(r[i] - l[i] + 1) *
           dp(i - 1, j - 1, k);
  }
  if (r[i] >= x && l[i] <= x && k) {
    res += 1.0 / double(r[i] - l[i] + 1) * dp(i - 1, j, k - 1);
    if (k == 2) res += 1.0 / double(r[i] - l[i] + 1) * dp(i - 1, j, k);
  }
  if (l[i] < x && j + k < i) {
    res += double(min(x - 1, r[i]) - l[i] + 1) / double(r[i] - l[i] + 1) *
           dp(i - 1, j, k);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> l[i] >> r[i];
  double kq = 0;
  for (int i = 1; i < mm; ++i) {
    memset(f, -0x3f, sizeof(f));
    x = i;
    kq += double(i) * (dp(n, 0, 2) + dp(n, 1, 1) + dp(n, 1, 2));
  }
  cout << setprecision(10) << fixed << kq << "\n";
}
