#include <bits/stdc++.h>
using namespace std;
double ans = 0, at = 0;
int n, l[5], r[5];
double prep[5][10001], prep2[5][10001];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d", &l[i], &r[i]);
  for (int v = 1; v <= 10000; v++) {
    for (int i = 1; i < (1 << n); i++) {
      int cnt = 0;
      for (int j = 0; j < n; j++)
        if (i & (1 << j)) cnt++;
      if (cnt > 1) {
        double prob = 1;
        for (int j = 0; j < n; j++) {
          if (i & (1 << j)) {
            if (l[j] <= v && v <= r[j])
              prob /= (r[j] - l[j] + 1.0);
            else
              prob = 0;
          } else {
            if (l[j] >= v)
              prob = 0;
            else if (r[j] >= v)
              prob *= (v - l[j] + .0) / (r[j] - l[j] + 1.0);
          }
        }
        ans += prob * v;
      } else {
        double p1 = 1, p2 = 1, mult = 1;
        for (int j = 0; j < n; j++) {
          if (i & (1 << j)) {
            if (r[j] <= v)
              mult = 0;
            else if (v >= l[j])
              mult = (r[j] - v + .0) / (r[j] - l[j] + 1.0);
          } else {
            if (l[j] > v)
              p1 = 0;
            else if (r[j] > v)
              p1 *= (v - l[j] + 1.0) / (r[j] - l[j] + 1.0);
          }
        }
        for (int j = 0; j < n; j++) {
          if (i & (1 << j)) {
          } else {
            if (l[j] >= v)
              p2 = 0;
            else if (r[j] >= v)
              p2 *= (v - l[j] + .0) / (r[j] - l[j] + 1.0);
          }
        }
        ans += (p1 - p2) * mult * v;
      }
    }
  }
  printf("%.12lf\n", ans);
  return 0;
}
