#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long l[100001], r[100001];
int main() {
  long long n, p;
  double s = 0;
  cin >> n >> p;
  for (int i = (0); i <= (n - 1); i++) cin >> l[i] >> r[i];
  for (int i = (0); i <= (n - 1); i++) {
    int j = i + 1;
    if (i == n - 1) j = 0;
    long long d1 = r[i] / p - (l[i] - 1) / p;
    long long d2 = r[j] / p - (l[j] - 1) / p;
    double t1 = d1 / (double)(r[i] - l[i] + 1);
    double t2 = d2 / (double)(r[j] - l[j] + 1);
    s += t1 + t2 - t1 * t2;
  }
  cout << setprecision(10) << s * 2000 << endl;
  return 0;
}
