#include <bits/stdc++.h>   using namespace std;   int main() {     int n, l[10], r[10], t = 1;     double ans = 0, o = 1;     cin >> n;     for (int i = 0; i < n; i++) {       t *= 2;       cin >> l[i] >> r[i];       o *= r[i] - l[i] + 1;     }     if (n == 1) {       cout << setprecision(10) << fixed << (r[0] + l[0]) / 2.0 << endl;       return 0;     }     for (int i = 1; i <= 10000; i++) {       for (int g = 0; g < n; g++) {         if (r[g] <= i) continue;         for (int j = 1; j < t; j++) {           int a[10] = {}, t2 = j, o = 0;           while (t2) {             a[o++] = t2 % 2;             t2 /= 2;           }           if (a[g]) continue;           double k = 1;           bool ch = 0;           for (int h = 0; h < n; h++) {             if (h == g) continue;             if (a[h] && (r[h] < i || l[h] > i)) {               ch = 1;               h = n;             }             if (!a[h] && l[h] >= i) {               ch = 1;               h = n;             }             if (!a[h]) k *= min(i - 1, r[h]) - l[h] + 1;           }           if (ch) continue;           k *= r[g] - max(i + 1, l[g]) + 1;           ans += k * i;         }       }     }     for (int i = 1; i <= 10000; i++) {       for (int j = 1; j < t; j++) {         int a[10] = {}, t2 = j, o = 0, d = 0;         while (t2) {           a[o++] = t2 % 2;           if (a[o - 1]) d++;           t2 /= 2;         }         double k = 1;         if (d == 1) continue;         bool ch = 0;         for (int h = 0; h < n; h++) {           if (a[h] && (r[h] < i || l[h] > i)) {             ch = 1;             h = n;           }           if (!a[h] && l[h] >= i) {             ch = 1;             h = n;           }           if (!a[h]) k *= min(i - 1, r[h]) - l[h] + 1;         }         if (ch) continue;         ans += k * i;       }     }     cout << setprecision(10) << fixed << ans / o << endl;     return 0;   }   