#include <bits/stdc++.h>
using namespace std;
int L[10], R[10];
int N;
double prob(int i, int num) {
  if (num < L[i]) return 0.0;
  num = min(R[i], num);
  return double(num - L[i] + 1) / double(R[i] - L[i] + 1);
}
double p(int mask, int maxi) {
  double ans = 0.0, pr;
  for (int nmask = (1); nmask < ((1 << N)); nmask++) {
    if ((nmask & mask) == (nmask)) {
      pr = 1.0;
      for (int i = (0); i < (N); i++) {
        if (!(mask & (1 << i))) continue;
        if (nmask & (1 << i)) {
          if (maxi >= L[i] and maxi <= R[i])
            pr *= (1.0 / double(R[i] - L[i] + 1));
          else
            pr *= 0.0;
        } else
          pr *= prob(i, maxi - 1);
      }
      ans += pr;
    }
  }
  return ans;
}
double aux(int mask, int maxi) {
  double pr = 1.0;
  for (int i = (0); i < (N); i++) {
    if (mask & (1 << i)) {
      if (maxi >= L[i] and maxi <= R[i])
        pr *= (1.0 / double(R[i] - L[i] + 1));
      else
        pr *= 0.0;
    } else
      pr *= prob(i, maxi - 1);
  }
  return pr;
}
int main() {
  cin >> N;
  for (int i = (0); i < (N); i++) {
    cin >> L[i] >> R[i];
  }
  double ans = 0.0;
  for (int i = (1); i < (10001); i++) {
    double pr = 0.0;
    for (int j = (0); j < (N); j++)
      pr += (p((1 << N) - 1 - (1 << j), i) * (1.0 - prob(j, i)));
    for (int mask = (0); mask < ((1 << N)); mask++) {
      if (__builtin_popcount(mask) > 1) {
        pr += aux(mask, i);
      }
    }
    ans += (double)i * pr;
  }
  printf("%.10lf\n", ans);
}
