#include <bits/stdc++.h>
using namespace std;
long long l[100100], r[100100];
int main() {
  long long cs, t, i, j, k, x, y, z, q, m, n, p;
  cin >> n >> p;
  for (i = 0; i < n; i++) {
    scanf("%lld", &l[i]);
    scanf("%lld", &r[i]);
  }
  double ans = 0;
  for (i = 0; i < n; i++) {
    double a, q;
    x = r[i] / p - (l[i] - 1) / p;
    a = (double)(r[i] - l[i] + 1 - x) / (double)(r[i] - l[i] + 1);
    y = r[(i + 1) % n] / p - (l[(i + 1) % n] - 1) / p;
    q = (double)(r[(i + 1) % n] - l[(i + 1) % n] + 1 - y) /
        (double)(r[(i + 1) % n] - l[(i + 1) % n] + 1);
    ans += 2000 - 2000 * a * q;
  }
  printf("%0.8lf\n", ans);
  return 0;
}
