#include <bits/stdc++.h>
using namespace std;
const int maxBid = 10010;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(9);
  int n, l[6], r[6];
  double ans = 0.0;
  cin >> n;
  for (int i = 0; i < (n); ++i) cin >> l[i] >> r[i];
  for (int b = (1); b < (maxBid); ++b) {
    double p[] = {1, 0, 0};
    for (int i = (0); i < (n); ++i) {
      double pi = max(r[i] - max(b, l[i]) + 1.0, 0.0) / (r[i] - l[i] + 1.0);
      p[2] += p[1] * pi;
      p[1] = (1.0 - pi) * p[1] + p[0] * pi;
      p[0] *= 1.0 - pi;
    }
    ans += p[2];
  }
  cout << fixed << ans << "\n";
  return 0;
}
