func_code_string: #include <bits/stdc++.h>   using namespace std;   struct __timestamper {};   int main() {     int n;     scanf( %d , &n);     vector<int> l(n), r(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++) {       double prob[3];       prob[0] = 1;       prob[1] = prob[2] = 0;       for (int j = 0; j < n; j++) {         double p = max(r[j] - max(l[j], i) + 1, 0) * 1.0 / (r[j] - l[j] + 1);         prob[2] += prob[1] * p;         prob[1] = prob[1] * (1.0 - p) + prob[0] * p;         prob[0] *= 1.0 - p;       }       ans += prob[2];     }     printf( %.10f n , ans);     return 0;   }   