#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > vec;
double func(pair<int, int> x, pair<int, int> y, int p) {
  long long total =
      (long long)(x.second - x.first + 1) * (long long)(y.second - y.first + 1);
  long long fav = 0;
  long long divU = x.second / p;
  long long divL = (x.first - 1) / p;
  fav = (divU - divL) * (long long)(y.second - y.first + 1);
  long long rem = (long long)(x.second - x.first + 1) - (divU - divL);
  divU = y.second / p;
  divL = (y.first - 1) / p;
  long long fav2 = (divU - divL) * (long long)rem;
  double inFav = fav + fav2;
  return (2000.0 * inFav) / (double)total;
}
int main() {
  int n, p;
  scanf("%d %d", &n, &p);
  for (int i = 0, l, r; i < n; i++) {
    scanf("%d %d", &l, &r);
    vec.push_back(make_pair(l, r));
  }
  vec.push_back(*vec.begin());
  double ans = 0;
  for (int i = 0; i < n; i++) ans += func(vec[i], vec[i + 1], p);
  printf("%.10lf\n", ans);
  return 0;
}
