#include <bits/stdc++.h>
int main() {
  int n, p, i;
  int L[100005], R[100005], Primo, Range;
  double expected, Prime_Prob[100005];
  int last, first;
  scanf("%d%d", &n, &p);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &L[i], &R[i]);
    first = L[i] / p;
    if (L[i] % p != 0) first++;
    last = R[i] / p;
    if (last >= first) {
      Primo = last - first + 1;
    } else
      Primo = 0;
    Range = R[i] - L[i] + 1;
    Prime_Prob[i] = ((Primo * 1.0) / Range);
  }
  expected = 0.0;
  for (i = 1; i < n; i++) {
    expected +=
        Prime_Prob[i] + Prime_Prob[i - 1] - Prime_Prob[i] * Prime_Prob[i - 1];
  }
  expected +=
      Prime_Prob[0] + Prime_Prob[n - 1] - Prime_Prob[0] * Prime_Prob[n - 1];
  expected *= 2000.0;
  printf("%.7lf\n", expected);
  return 0;
}
