#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897932384626433832795;
const long double EPS = 1e-11;
signed long long n, t, tmin, tmax, tt;
signed long long kw, kall;
pair<signed long long, signed long long> a[5];
signed long long ans, K;
long double ANS;
bool b[5];
signed long long more(signed long long c, signed long long ind) {
  signed long long mmin = max(c + 1, a[ind].first);
  return max(0ll, a[ind].second - mmin + 1);
}
signed long long les(signed long long c, signed long long ind) {
  signed long long mmax = min(c - 1, a[ind].second);
  return max(0ll, mmax - a[ind].first + 1);
}
bool can(signed long long c, signed long long ind) {
  return (c >= a[ind].first && c <= a[ind].second);
}
int main() {
  cout << setiosflags(ios::fixed) << setprecision(10);
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> a[i].first >> a[i].second;
  for (signed long long c = 1; c <= 10000; c++)
    for (int m = 1; m < (1 << n); m++) {
      t = m, tt = 0;
      for (int j = 0; j < (n); j++) {
        b[j] = t % 2;
        if (b[j] == 1) tt++;
        t /= 2;
      }
      if (tt >= 2) {
        kw = 1;
        for (int j = 0; j < (n); j++) {
          if (b[j])
            kw *= can(c, j);
          else
            kw *= les(c, j);
        }
        ans += c * kw;
        K += kw;
        ANS += (double)c * kw;
      }
      for (int i = 0; i < (n); i++)
        if (b[i] == 0) {
          kw = 1;
          tt = 0;
          for (int j = 0; j < (n); j++) {
            if (i == j)
              kw *= more(c, j);
            else {
              if (b[j]) {
                kw *= can(c, j);
                tt++;
              } else
                kw *= les(c, j);
            }
          }
          if (tt < 1) kw = 0;
          ans += c * kw;
          K += kw;
          ANS += (double)c * kw;
        }
    }
  for (int i = 0; i < (n); i++) ANS /= (a[i].second - a[i].first + 1);
  cout << (double)ANS << endl;
  return 0;
}
