#include <bits/stdc++.h>
#pragma comment(linker, "/stack:32000000")
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
double getprob(int L, int R, int l, int r) {
  if (l > r) return 0;
  int maxl = max(L, l);
  int minr = min(R, r);
  if (maxl > minr) return 0;
  return (minr - maxl + 1.) / (R - L + 1);
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> L(n), R(n);
  for (int i = 0; i < n; ++i) scanf("%d%d", &L[i], &R[i]);
  double answer = 0;
  const int maxprice = 10010;
  for (int res = 1; res < maxprice; ++res) {
    double curmult = 0;
    for (int winner = 0; winner < n; ++winner) {
      double prob = getprob(L[winner], R[winner], res + 1, maxprice);
      double tmp1 = 1.;
      double tmp2 = 1.;
      for (int i = 0; i < n; ++i) {
        if (i == winner) continue;
        tmp1 *= getprob(L[i], R[i], 0, res - 1);
        tmp2 *= getprob(L[i], R[i], 0, res);
      }
      prob *= tmp2 - tmp1;
      curmult += prob;
    }
    for (int msk = 0; msk < (1 << n); ++msk) {
      double curadd = 1;
      int cc = 0;
      for (int i = 0; i < n; ++i) {
        if ((msk >> i) & 1)
          ++cc, curadd *= getprob(L[i], R[i], res, res);
        else
          curadd *= getprob(L[i], R[i], 0, res - 1);
      }
      if (cc >= 2) curmult += curadd;
    }
    answer += curmult * res;
  }
  printf("%.15lf\n", answer);
  return 0;
}
