#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000009;
const int MOD = 1000000007;
double probMayor(pair<int, int> x, int bid) {
  if (bid < x.first) {
    return 1.0;
  }
  if (bid > x.second) {
    return 0.0;
  }
  return double(x.second - bid) / (x.second - x.first + 1);
}
double probMenor(pair<int, int> x, int bid) {
  if (bid < x.first) {
    return 0.0;
  }
  if (bid > x.second) {
    return 1.0;
  }
  return double(bid - x.first) / (x.second - x.first + 1);
}
double go(vector<pair<int, int> > v, int idx, int bid, int cnt) {
  if (idx >= v.size()) {
    if (cnt <= 0) {
      return 1;
    }
    return 0;
  }
  double res = 0.0;
  if (bid >= v[idx].first && bid <= v[idx].second) {
    res += go(v, idx + 1, bid, cnt - 1) *
           (1.0 / (v[idx].second - v[idx].first + 1));
  }
  res += go(v, idx + 1, bid, cnt) * probMenor(v[idx], bid);
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    v.push_back(make_pair(l, r));
  }
  double res = 0.0;
  for (int i = 0; i < n; i++) {
    pair<int, int> p = v[i];
    v.erase(v.begin() + i);
    for (int j = 1; j <= 10000; j++) {
      res += probMayor(p, j) * j * go(v, 0, j, 1);
    }
    v.insert(v.begin() + i, p);
  }
  for (int j = 1; j <= 10000; j++) {
    res += j * go(v, 0, j, 2);
  }
  printf("%.10f\n", res);
  return 0;
}
