#include <bits/stdc++.h>
int main() {
  int n, p;
  std::cin >> n >> p;
  std::vector<int> l(n), r(n);
  for (int i = 0; i < n; ++i) std::cin >> l[i] >> r[i];
  double ans = 0;
  auto CountDivisor = [](int x, int n) {
    if (n == 0) {
      return 0;
    }
    return n / x;
  };
  auto CountDivisorRange = [CountDivisor](int x, int l, int r) {
    return CountDivisor(x, r) - CountDivisor(x, l - 1);
  };
  for (int i = 0; i < n; ++i) {
    int j = (i + 1) % n;
    int numI = CountDivisorRange(p, l[i], r[i]);
    int numJ = CountDivisorRange(p, l[j], r[j]);
    int64_t total = (int64_t)(r[i] - l[i] + 1) * (r[j] - l[j] + 1);
    int64_t numWay =
        total - (int64_t)(r[i] - l[i] + 1 - numI) * (r[j] - l[j] + 1 - numJ);
    ans += (double)numWay / total;
  }
  std::cout << std::fixed << std::setprecision(12) << 2000 * ans << '\n';
  return 0;
}
