#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline void sub(long long &a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
inline void add(long long &a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
template <typename T>
inline T const &MAX(T const &a, T const &b) {
  return a > b ? a : b;
}
template <typename T>
inline T const &MIN(T const &a, T const &b) {
  return a < b ? a : b;
}
inline long long qp(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % 1000000007;
    a = a * a % 1000000007, b >>= 1;
  }
  return ans;
}
inline long long qp(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % c;
    a = a * a % c, b >>= 1;
  }
  return ans;
}
using namespace std;
const unsigned long long ba = 233;
const double eps = 1e-5;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 200 + 10, maxn = 2000000 + 10, inf = 0x3f3f3f3f;
int l[10], r[10];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &l[i], &r[i]);
  double ans = 0;
  for (int i = 1; i <= 10000; i++) {
    for (int j = 0; j < (1 << n); j++) {
      if (__builtin_popcount(j) < 2) continue;
      double res = 1;
      for (int k = 0; k < n; k++) {
        int x = l[k], y = r[k];
        if ((j >> k) & 1)
          x = max(x, i);
        else
          y = min(y, i - 1);
        if (x <= y)
          res = res * (y - x + 1) / (r[k] - l[k] + 1);
        else
          res = 0;
      }
      ans += res;
    }
  }
  printf("%.12f\n", ans);
  return 0;
}
