#include <bits/stdc++.h>
using namespace std;
int n, l[5], r[5];
double f(int winners, int secondBid) {
  if (__builtin_popcount(winners) == 1) {
    int winl = secondBid + 1, winr = 10000;
    for (int i = 0; i < n; i++) {
      if ((1 << i) & winners) {
        winl = max(l[i], winl);
        winr = min(r[i], winr);
      }
    }
    if (winl > winr) {
      return 0.0;
    }
    double prob = 1.0;
    for (int i = 0; i < n; i++) {
      if (((1 << i) & winners) == 0) {
        if (secondBid < l[i]) {
          return 0.0;
        }
        if (r[i] > secondBid) {
          prob *= (secondBid - l[i] + 1.0) / (r[i] - l[i] + 1.0);
        }
      }
    }
    double probNoSecond = 1.0;
    for (int i = 0; i < n; i++) {
      if (((1 << i) & winners) == 0) {
        if (r[i] > secondBid - 1) {
          probNoSecond *= (secondBid - l[i] * 1.0) / (r[i] - l[i] + 1.0);
        }
      }
    }
    prob -= probNoSecond;
    double winnerProb = 1.0;
    for (int i = 0; i < n; i++) {
      if ((1 << i) & winners) {
        winnerProb *= 1.0 / (r[i] - l[i] + 1.0);
      }
    }
    winnerProb *= (winr - winl + 1);
    return winnerProb * prob;
  } else {
    int winl = secondBid, winr = secondBid;
    for (int i = 0; i < n; i++) {
      if ((1 << i) & winners) {
        winl = max(l[i], winl);
        winr = min(r[i], winr);
      }
    }
    if (winl > winr) {
      return 0.0;
    }
    double prob = 1.0;
    for (int i = 0; i < n; i++) {
      if (((1 << i) & winners) == 0) {
        if (secondBid - 1 < l[i]) {
          return 0.0;
        }
        if (r[i] > secondBid - 1) {
          prob *= (secondBid - l[i] * 1.0) / (r[i] - l[i] + 1.0);
        }
      }
    }
    double winnerProb = 1.0;
    for (int i = 0; i < n; i++) {
      if ((1 << i) & winners) {
        winnerProb *= 1.0 / (r[i] - l[i] + 1.0);
      }
    }
    winnerProb *= (winr - winl + 1);
    return winnerProb * prob;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  double ans = 0.0;
  for (int mask = 1; mask < (1 << n); mask++) {
    for (int val = 1; val <= 10000; val++) {
      ans += val * f(mask, val);
    }
  }
  cout << fixed << setprecision(10) << ans << "\n";
}
