#include <bits/stdc++.h>
using namespace std;
int n, L[10], R[10];
double tp[50][10500];
double sp[50][10500];
double tb[50][10500];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", L + i, R + i);
  for (int x = 1; x <= 10000; x++) {
    for (int state = 0; state < (1 << n); state++) {
      double &s = sp[state][x];
      s = 1;
      for (int i = 0; i < n; i++)
        if ((state >> i) & 1) {
          if (L[i] <= x && x <= R[i])
            s *= 1. / (R[i] - L[i] + 1);
          else {
            s = 0;
            break;
          }
        }
      double &t = tp[state][x];
      t = 1;
      for (int i = 0; i < n; i++)
        if ((state >> i) & 1) {
          t *= (double)max(min(R[i], x) - L[i] + 1, 0) / (R[i] - L[i] + 1);
        }
      tb[state][x] = tb[state][x - 1];
      tb[state][x] += x * (tp[state][x] - tp[state][x - 1]);
    }
  }
  double res = tb[(1 << n) - 1][1];
  for (int x = 2; x <= 10000; x++) {
    for (int state = 1; state < (1 << n); state++) {
      int op = state ^ ((1 << n) - 1);
      if (state == (state & -state))
        res += sp[state][x] * tb[op][x - 1];
      else
        res += x * sp[state][x] * tp[op][x - 1];
    }
  }
  printf("%.20lf\n", res);
  return 0;
}
