#include <bits/stdc++.h>
int main() {
  int n, i, p, l, r;
  double f[100010];
  scanf("%d%d", &n, &p);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &l, &r);
    f[i] = 1 - (double)(r / p - (l - 1) / p) / (r - l + 1);
  }
  double sum = 1 - f[1] * f[n];
  for (i = 1; i < n; i++) sum += 1 - f[i] * f[i + 1];
  sum *= 2000;
  printf("%f", sum);
  return 0;
}
