#include <bits/stdc++.h>
long long l[100005], r[100005];
long long p;
long long pro(long long i) {
  long long x1, y1;
  x1 = (r[i] / p - (l[i] - 1) / p);
  y1 = (r[i + 1] / p - (l[i + 1] - 1) / p);
  long long ans =
      (x1 * (r[i + 1] - l[i + 1] + 1) + (y1 * (r[i] - l[i] + 1 - x1)));
  return ans;
}
int main() {
  long long n;
  scanf("%lld", &n);
  scanf("%lld", &p);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &l[i]);
    scanf("%lld", &r[i]);
  }
  l[n] = l[0];
  r[n] = r[0];
  double ans = 0.0, pr = 2000.000;
  for (int i = 0; i < n; i++) {
    ans = ans + (1.00 * pro(i)) /
                    (double((r[i] - l[i] + 1) * (r[i + 1] - l[i + 1] + 1)));
  }
  ans = ans * pr;
  printf("%.9lf\n", ans);
  return 0;
}
