#include <bits/stdc++.h>
using namespace std;
long long n, l[100042], r[100042], p;
long double ans;
long long getC(long long cl, long long cr) {
  cl--;
  return cr / p - cl / p;
}
int main() {
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  l[n] = l[0];
  r[n] = r[0];
  for (int i = 0; i < n; i++) {
    ans += 2000. *
           (getC(l[i], r[i]) * (r[i + 1] - l[i + 1] + 1) +
            getC(l[i + 1], r[i + 1]) * (r[i] - l[i] + 1) -
            getC(l[i], r[i]) * getC(l[i + 1], r[i + 1])) /
           (r[i] - l[i] + 1) / (r[i + 1] - l[i + 1] + 1);
  }
  cout << setprecision(8);
  cout << ans << "\n";
  return 0;
}
