#include <bits/stdc++.h>
int L[5];
int R[5];
int D[5];
double h[5], l[5], m[5];
int n, i, j;
double ans = 0;
double f(int i, char mid, char higher) {
  if (i == n) return (double)(mid + higher > 1);
  double ret = 0;
  if (!higher) {
    ret += h[i] * f(i + 1, mid, 1);
  }
  ret += m[i] * f(i + 1, mid + 1, higher);
  ret += l[i] * f(i + 1, mid, higher);
  return ret;
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d%d", L + i, R + i), D[i] = R[i] - L[i] + 1;
  for (i = 1; i <= 10000; i++) {
    for (j = 0; j < n; j++) {
      if (R[j] > i) {
        if (L[j] > i) {
          h[j] = 1;
        } else {
          h[j] = (R[j] - i) / (double)D[j];
        }
      } else
        h[j] = 0;
      if (R[j] >= i && L[j] <= i) {
        m[j] = 1 / (double)D[j];
      } else
        m[j] = 0;
      if (L[j] < i) {
        if (R[j] < i) {
          l[j] = 1;
        } else {
          l[j] = (i - L[j]) / (double)D[j];
        }
      } else
        l[j] = 0;
    }
    ans += f(0, 0, 0) * i;
  }
  printf("%.12f", ans);
}
