#include <bits/stdc++.h>
using namespace std;
int n, p, x, y;
double pr = 0, t, f, k;
double prob(int x, int y) {
  return (double)(y / p - (x - 1) / p) / (y - x + 1);
}
int main() {
  for (cin >> n >> p, cin >> x >> y, n--, k = f = prob(x, y); n; n--)
    cin >> x >> y, t = prob(x, y), pr += t + f - t * f, f = t;
  printf("%f", (pr + t + k - t * k) * 2000);
}
