#include <bits/stdc++.h>
using namespace std;
int l[5];
int r[5];
double dp1[32][2];
double dp2[5];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", l + i, r + i);
  }
  for (int i = 0; i < (1 << n); ++i) {
    dp2[i] = 0;
  }
  double ans = 0;
  for (int i = 10000; i >= 1; --i) {
    dp1[0][0] = 1;
    dp1[0][1] = 0;
    for (int j = 1; j < (1 << n); ++j) {
      dp1[j][0] = dp1[j][1] = 0;
      int k = 0;
      while (((j >> k) & 1) == 0) {
        ++k;
      }
      if (i < l[k]) {
        continue;
      }
      if (i <= r[k]) {
        dp1[j][1] += dp1[j ^ (1 << k)][0] / (r[k] - l[k] + 1);
        dp1[j][1] += dp1[j ^ (1 << k)][1] / (r[k] - l[k] + 1);
      }
      dp1[j][0] +=
          dp1[j ^ (1 << k)][0] / (r[k] - l[k] + 1) * (min(r[k] + 1, i) - l[k]);
      dp1[j][1] +=
          dp1[j ^ (1 << k)][1] / (r[k] - l[k] + 1) * (min(r[k] + 1, i) - l[k]);
    }
    double cur = 0;
    for (int j = 0; j < (1 << n); ++j) {
      int cnt = 0;
      for (int k = 0; k < n; ++k) {
        if ((j >> k) & 1) {
          ++cnt;
        }
      }
      if (cnt < 2) {
        continue;
      }
      double pr = 1;
      for (int k = 0; k < n; ++k) {
        if ((j >> k) & 1) {
          if (i >= l[k] && i <= r[k]) {
            pr /= r[k] - l[k] + 1;
          } else {
            pr = 0;
          }
        } else {
          if (l[k] > i - 1) {
            pr = 0;
          } else {
            pr /= r[k] - l[k] + 1;
            pr *= min(r[k] + 1, i) - l[k];
          }
        }
      }
      cur += pr;
    }
    for (int j = 0; j < n; ++j) {
      cur += dp1[((1 << n) - 1) ^ (1 << j)][1] * dp2[j];
    }
    ans += i * cur;
    for (int j = 0; j < n; ++j) {
      if (i >= l[j] && i <= r[j]) {
        dp2[j] += 1.0 / (r[j] - l[j] + 1);
      }
    }
  }
  printf("%.15f", ans);
}
