#include <bits/stdc++.h>
using namespace std;
double ans = 0;
long long la[100010], ra[100010], di[100010], tot[100010];
int main() {
  int n, p, i;
  cin >> n >> p;
  for (i = 0; i < n; i++) {
    cin >> la[i] >> ra[i];
  }
  for (i = 0; i < n; i++) {
    di[i] = (((ra[i]) / p) - ((la[i] - 1) / p));
    tot[i] = (ra[i] - la[i] + 1);
  }
  ans = ans +
        ((double)(di[0] * tot[n - 1] + tot[0] * di[n - 1] - di[0] * di[n - 1]) /
         ((tot[0]) * (tot[n - 1]))) *
            2000;
  for (i = 1; i < n; i++) {
    ans =
        ans +
        ((double)(di[i] * tot[i - 1] + tot[i] * di[i - 1] - di[i] * di[i - 1]) /
         ((tot[i]) * (tot[i - 1]))) *
            2000;
  }
  printf("%lf", ans);
}
