#include <bits/stdc++.h>
using namespace std;
int l[5], r[5];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d", &l[i], &r[i]);
  long double ans = 0;
  long double dem = 0;
  setprecision(30);
  for (int tap = 1; tap < (1 << (n)); tap++) {
    int L = -1e9, R = 1e9;
    for (int i = 0; i < n; i++) {
      if (tap & (1 << (i))) {
        L = max(L, l[i]);
        R = min(R, r[i]);
      }
    }
    if (L > R) continue;
    for (int b = L; b <= R; b++) {
      for (int win = 0; win < n; win++) {
        if (tap & (1 << (win))) continue;
        if (r[win] <= b) continue;
        long double c = r[win] - max(l[win] - 1, b);
        for (int j = 0; j < n; j++) {
          if (j == win) continue;
          if (tap & (1 << (j))) continue;
          if (l[j] >= b) {
            c = 0;
            break;
          }
          c = c * (min(r[j] + 1, b) - l[j]);
        }
        ans = ans + c * b;
        dem += c;
      }
      long double c = 1;
      if (__builtin_popcount(tap) == 1) continue;
      for (int other = 0; other < n; other++) {
        if (tap & (1 << (other))) continue;
        if (l[other] >= b) {
          c = 0;
          break;
        }
        c = c * (min(r[other] + 1, b) - l[other]);
      }
      ans = ans + c * b;
      dem += c;
    }
  }
  cout << setprecision(10) << fixed << ans / (dem + 0.0000000) << endl;
}
