#include <bits/stdc++.h>
double p[100005];
int main() {
  int i;
  double ans;
  int n, prime;
  while (scanf("%d%d", &n, &prime) != EOF) {
    ans = 0;
    for (i = 0; i < n; i++) {
      int left, right;
      scanf("%d%d", &left, &right);
      p[i] = (right / prime - (left - 1) / prime) * 1.0 / (right - left + 1);
    }
    for (i = 0; i < n; i++) ans += 1 - (1 - p[i]) * (1 - p[(i + 1) % n]);
    printf("%.7f\n", ans * 2000);
  }
  return 0;
}
