#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-9;
const int MAXC = 1e4 + 10;
int n;
int l[10];
int r[10];
long double prob_eq(int id, int x) {
  if (x < l[id] || r[id] < x) {
    return 0.0;
  }
  return 1.0 / (r[id] - l[id] + 1);
}
long double prob_less(int id, int x) {
  if (r[id] < x) {
    return 1.0;
  }
  if (x <= l[id]) {
    return 0.0;
  }
  return (long double)(x - l[id]) / (r[id] - l[id] + 1);
}
long double prob_gr(int id, int x) {
  if (r[id] <= x) {
    return 0.0;
  }
  if (x < l[id]) {
    return 1.0;
  }
  return (long double)(r[id] - x) / (r[id] - l[id] + 1);
}
bool bit(int mask, int i) { return (mask >> i) & 1; }
int main() {
  cin >> n;
  for (int i = 0; i < (int)n; ++i) {
    cin >> l[i] >> r[i];
  }
  long double ans = 0;
  for (int x = 1; x < MAXC; ++x) {
    for (int who_gr = 0; who_gr < (int)n; ++who_gr) {
      long double P = prob_gr(who_gr, x);
      long double prob1 = 1.0;
      for (int i = 0; i < (int)n; ++i) {
        if (i != who_gr) {
          prob1 *= prob_less(i, x + 1);
        }
      }
      long double prob2 = 1.0;
      for (int i = 0; i < (int)n; ++i) {
        if (i != who_gr) {
          prob2 *= prob_less(i, x);
        }
      }
      P *= prob1 - prob2;
      ans += P * x;
    }
    for (int mask = 0; mask < (int)1 << n; ++mask) {
      long double P = 1.0;
      if (__builtin_popcount(mask) <= 1) {
        continue;
      }
      for (int i = 0; i < (int)n; ++i) {
        if (bit(mask, i)) {
          P *= prob_eq(i, x);
        } else {
          P *= prob_less(i, x);
        }
      }
      ans += P * x;
    }
  }
  printf("%.15f\n", (double)ans);
  return 0;
}
