#include <bits/stdc++.h>
int i, n, p, l, r;
long long L, M, P, Q, V, W;
double t, w, a;
int main() {
  for (scanf("%d%d", &n, &p); i <= n; i++, P = L, Q = M) {
    if (i < n)
      scanf("%d%d", &l, &r), L = r - l + 1, M = r / p - (l - 1) / p;
    else
      L = V, M = W;
    if (i)
      t = L * P, w = M * P + (L - M) * Q, a += 2000 * w / t;
    else
      V = L, W = M;
  }
  printf("%.9f", a);
}
