#include <bits/stdc++.h>
using namespace std;
int n;
int L[5], R[5];
int bits[1 << 5];
double DP[10001][1 << 5];
bool done[10001][1 << 5];
double dp(int cur, int mask) {
  if (bits[mask] >= n - 1) return cur - 1;
  double &ret = DP[cur][mask];
  if (done[cur][mask]) return ret;
  ret = 0;
  done[cur][mask] = true;
  for (int thisTurn = 0; thisTurn < (1 << n); thisTurn++) {
    if ((thisTurn & mask) > 0) continue;
    double prob = 1;
    for (int i = 0; i < n; i++) {
      if ((mask & (1 << i)) > 0) continue;
      if ((thisTurn & (1 << i)) > 0) {
        double p = double(1) / double(R[i] - cur + 1);
        if (cur < L[i] || cur > R[i]) p = 0;
        prob *= p;
      } else {
        double p = double(1) / double(R[i] - cur + 1);
        if (cur < L[i] || cur > R[i]) p = 0;
        prob *= 1 - p;
      }
    }
    if (prob == 0) continue;
    ret += prob * dp(cur + 1, mask | thisTurn);
  }
  return ret;
}
int MAIN() {
  bits[0] = 0;
  for (int i = 1; i < (1 << 5); i++) bits[i] = bits[i / 2] + (i & 1);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> L[i] >> R[i];
  memset(done, false, sizeof(done));
  cout << dp(1, 0) << endl;
  return 0;
}
int main() {
  int start = clock();
  ios ::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  int ret = MAIN();
  return ret;
}
