func_code_string: #include <bits/stdc++.h>   using namespace std;   long long qk(long long x, long long y) {     long long ans = 1;     while (y) {       if (y & 1) ans = ans * x % 1000000007;       y >>= 1;       x = x * x % 1000000007;     }     return ans;   }   const int dx[8] = {0, -1, 0, 1, -1, -1, 1, 1},             dy[8] = {-1, 0, 1, 0, -1, 1, -1, 1};   const int dxx[8] = {2, 1, -1, -2, -2, -1, 1, 2},             dyy[8] = {1, 2, 2, 1, -1, -2, -2, -1};   long long a[100005], b[100005];   void solve() {     long long n, p;     scanf( %lld%lld , &n, &p);     for (int i = 1; i <= n; i++) {       long long x, y;       scanf( %lld%lld , &x, &y);       a[i] = y / p - (x - 1) / p;       b[i] = y - x + 1;     }     double ans = 0;     for (int i = 1; i < n; i++) {       double num = a[i] * b[i + 1];       num += a[i + 1] * (b[i] - a[i]);       ans += 2000.0 * num / (double)(b[i] * b[i + 1]);     }     double num = a[n] * b[1];     num += a[1] * (b[n] - a[n]);     ans += 2000.0 * num / (double)(b[n] * b[1]);     printf( %.7lf n , ans);   }   int main() {     solve();     return 0;   }   