#include <bits/stdc++.h>
using namespace std;
int main() {
  double ans = 0;
  int n;
  cin >> n;
  int p;
  cin >> p;
  vector<int> L, R;
  for (int i = 0 - (0 > n); i != n - (0 > n); i += 1 - 2 * (0 > n)) {
    int l, r;
    cin >> l >> r;
    L.push_back(l);
    R.push_back(r);
  }
  L.push_back(L[0]);
  R.push_back(R[0]);
  for (int i = 0 - (0 > n); i != n - (0 > n); i += 1 - 2 * (0 > n)) {
    int l, r;
    int ll, rr;
    l = L[i];
    r = R[i];
    ll = L[i + 1];
    rr = R[i + 1];
    int u = r / p - (l - 1) / p;
    int uu = rr / p - (ll - 1) / p;
    ans += 2000.0 * (1.0 * u / (r - l + 1) + (1.0 - 1.0 * u / (r - l + 1)) *
                                                 (1.0 * uu / (rr - ll + 1)));
  }
  cout << setprecision(15) << ans << "\n";
  return 0;
}
