#include <bits/stdc++.h>
using namespace std;
long long n, pr;
double p[100010];
int main() {
  double ans = 0;
  scanf("%I64d%I64d", &n, &pr);
  for (int i = 0; i < n; i++) {
    long long l, r;
    scanf("%I64d%I64d", &l, &r);
    p[i] =
        ((r - l + 1) - 1.0 * ((r / pr) - ((l - 1) / pr))) / (1.0 * (r - l + 1));
    if (i) ans += (1.0 - p[i] * p[i - 1]);
  }
  ans += (1.0 - p[0] * p[n - 1]);
  printf("%.10f\n", 2000 * ans);
  return 0;
}
