#include <bits/stdc++.h>
using namespace std;
double p[100100];
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    int i;
    for (i = 1; i <= n; i++) {
      int l, r;
      scanf("%d%d", &l, &r);
      int temp = (r / m - l / m);
      if (l % m == 0) temp++;
      p[i] = 1.0 - (double)temp / (r - l + 1);
    }
    double ans = 0;
    for (i = 1; i < n; i++) {
      ans += (1 - p[i] * p[i + 1]) * 2000;
    }
    ans += (1 - p[n] * p[1]) * 2000;
    printf("%.9lf\n", ans);
  }
}
