func_code_string: #include <bits/stdc++.h>   using namespace std;   long long N, P;   long long L[100001];   long long R[100001];   long long getAc(long long l, long long r, long long p) {     if ((l + p - 1) / p * p > r) return 0;     return (r - (l + p - 1) / p * p) / p + 1;   }   int main() {     scanf( %lld%lld , &N, &P);     for (int i = 0; i < N; i++) scanf( %lld%lld , &L[i], &R[i]);     double ans = 0;     for (int i = 0; i < N; i++) {       long long a = getAc(L[i], R[i], P);       long long b = getAc(L[(i + 1) % N], R[(i + 1) % N], P);       long long cur = (R[i] - L[i] + 1) * b;       cur += (R[(i + 1) % N] - L[(i + 1) % N] + 1) * a;       cur -= a * b;       ans += (double)cur * 2000 / (R[i] - L[i] + 1) /              (R[(i + 1) % N] - L[(i + 1) % N] + 1);     }     printf( %.8f , (double)ans);     return 0;   }   