#include <bits/stdc++.h>
using namespace std;
int n, l[5], r[5], t[5], pre[5][50005] = {0}, post[5][50005] = {0}, v[100];
double ans = 0;
double solve(int x) {
  double ret = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < (1 << n); j++) {
      if (j == (1 << i)) continue;
      if ((j & (1 << i)) && v[j]) continue;
      if (j & (1 << i)) v[j] = 1;
      double tmp = 1;
      for (int k = j, cnt = 0; cnt < n; k >>= 1, cnt++) {
        if (1 & k) {
          tmp *= (x >= l[cnt] && x <= r[cnt]) * 1.0 / t[cnt];
        } else {
          if (cnt == i)
            tmp *= post[cnt][x + 1] * 1.0 / t[cnt];
          else
            tmp *= pre[cnt][x - 1] * 1.0 / t[cnt];
        }
      }
      ret += tmp;
    }
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    t[i] = r[i] - l[i] + 1;
    for (int j = 1; j <= 50000; j++) {
      if (j >= l[i]) pre[i][j] = min(j, r[i]) - l[i] + 1;
      if (j <= r[i]) post[i][j] = r[i] - max(j, l[i]) + 1;
    }
  }
  for (int i = 1; i <= 50000; i++) {
    memset(v, 0, sizeof(v));
    ans += i * solve(i);
  }
  printf("%.12f\n", ans);
  return 0;
}
