#include <bits/stdc++.h>
using namespace std;
const int maxn = 55;
int L[maxn], R[maxn];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    double sum = 0;
    for (int i = 0; i < n; i++) scanf("%d%d", L + i, R + i);
    for (int now = 1; now <= 10010; now++) {
      for (int sta = 0; sta < (1 << n); sta++) {
        int cnt_1 = 0;
        for (int i = 0; i < n; i++)
          if (sta & (1 << i)) cnt_1++;
        if (cnt_1 < 2) continue;
        double res = 1.0;
        for (int i = 0; i < n; i++) {
          int l = L[i];
          int r = R[i];
          double pro = 1.0;
          if (sta & (1 << i)) {
            if (l < now) l = now;
          } else {
            if (r > now - 1) r = now - 1;
          }
          if (l > r) {
            res = 0.0;
            break;
          }
          int cur = r - l + 1;
          res *= 1.0 * cur / (R[i] - L[i] + 1);
        }
        sum += res;
      }
    }
    printf("%.15lf\n", sum);
  }
}
