#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(cin.tie(0));
  int64_t n, p;
  cin >> n >> p;
  int64_t l[n], r[n];
  for (int64_t i = 0; i < n; i++) cin >> l[i] >> r[i];
  double ans = 0;
  for (int64_t i = 0; i < n - 1; i++) {
    int64_t t1, k1, t2, k2;
    t1 = r[i] - l[i] + 1, k1 = r[i] / p - (l[i] - 1) / p;
    t2 = r[i + 1] - l[i + 1] + 1, k2 = r[i + 1] / p - (l[i + 1] - 1) / p;
    double prob = ((1.0 * t1 - k1) / t1) * ((1.0 * t2 - k2) / t2);
    prob = 1 - prob;
    ans += 2000 * prob;
  }
  int64_t t1, k1, t2, k2;
  t1 = r[0] - l[0] + 1, k1 = r[0] / p - (l[0] - 1) / p;
  t2 = r[n - 1] - l[n - 1] + 1, k2 = r[n - 1] / p - (l[n - 1] - 1) / p;
  double prob = ((1.0 * t1 - k1) / t1) * ((1.0 * t2 - k2) / t2);
  prob = 1 - prob;
  ans += 2000 * prob;
  cout << fixed << setprecision(6) << ans << "\n";
  return 0;
}
