#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int INF = 1e9 + 7;
const double eps = 1e-7;
int a[11], b[11];
int n;
bool no_intersect(int m1, int m2) {
  if (m1 == 0) return false;
  if ((m1 & m2) > 0) return false;
  return true;
}
double find_intersect(int m1, int L) {
  double prob = 1.0;
  for (int i = 0; i < n; i++) {
    if ((1 << i) & m1) {
      if (b[i] < L || a[i] > L) return 0.0;
      prob *= 1.0 / (1.0 * (b[i] - a[i] + 1));
    }
  }
  return prob;
}
double find_range(int m1, int L) {
  double prob = 1.0;
  int maxA = 0, minB = 11111111;
  for (int i = 0; i < n; i++) {
    if ((1 << i) & m1) {
      maxA = max(a[i], maxA);
      minB = min(b[i], minB);
    }
  }
  if (L < maxA || L > minB)
    return 0.0;
  else {
    for (int i = 0; i < n; i++) {
      if ((1 << i) & m1) {
        prob = prob * (1.0) / ((b[i] - a[i] + 1.0) * 1.0);
      }
    }
  }
  return prob;
}
double find_range1(int m1, int L) {
  double prob = 1.0;
  int maxA = 0, minB = 11111111;
  for (int i = 0; i < n; i++) {
    if ((1 << i) & m1) {
      maxA = max(a[i], maxA);
      minB = min(b[i], minB);
    }
  }
  if (L + 1 > minB) return 0.0;
  maxA = max(maxA, L + 1);
  if (maxA > minB)
    return 0.0;
  else {
    for (int i = 0; i < n; i++) {
      if ((1 << i) & m1) {
        prob = prob * (1.0 * (minB - maxA + 1.0)) / ((b[i] - a[i] + 1.0) * 1.0);
      }
    }
  }
  return prob;
}
double rest_all(int m1, int m2, int L) {
  double prob = 1.0;
  for (int i = 0; i < n; i++) {
    if (((1 << i) & m1) == 0 && ((1 << i) & m2) == 0) {
      if (a[i] >= L)
        return 0.0;
      else
        prob *= ((min(b[i], L - 1) - a[i] + 1.0) * 1.0) /
                ((b[i] - a[i] + 1.0) * 1.0);
    }
  }
  return prob;
}
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  double ans = 0.0;
  for (int mask1 = 1; mask1 < (1 << n); mask1++) {
    for (int mask2 = 1; mask2 < (1 << n); mask2++) {
      if (no_intersect(mask1, mask2) == false) continue;
      for (int L = 1; L <= 10000; L++) {
        if (mask1 == (1 << n) - 1 || __builtin_popcount(mask1) > 1) {
          continue;
        }
        ans += (find_range1(mask1, L) * find_intersect(mask2, L) *
                rest_all(mask1, mask2, L) * L);
      }
    }
  }
  for (int mask1 = 1; mask1 < (1 << n); mask1++) {
    for (int L = 1; L <= 10000; L++) {
      if (mask1 == (1 << n) - 1 || __builtin_popcount(mask1) > 1) {
        ans += (find_range(mask1, L) * rest_all(mask1, 0, L) * L);
      }
    }
  }
  printf("%.10f\n", ans);
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
