#include <bits/stdc++.h>
struct shark {
  int x;
  int y;
  double n;
};
int main() {
  int n, p;
  scanf("%d%d", &n, &p);
  struct shark a[n];
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    if (a[i].x % p != 0)
      a[i].n = (double)(a[i].y / p - a[i].x / p) / (a[i].y - a[i].x + 1);
    else
      a[i].n = (double)(a[i].y / p - a[i].x / p + 1) / (a[i].y - a[i].x + 1);
  }
  double sum = 0;
  for (int i = 0; i < n; i++) {
    if (i != n - 1) {
      sum += (1 - (1 - a[i].n) * (1 - a[i + 1].n)) * 2000;
    } else {
      sum += (1 - (1 - a[i].n) * (1 - a[0].n)) * 2000;
    }
  }
  printf("%.6lf", sum);
  return 0;
}
