#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, p;
  cin >> n >> p;
  vector<pair<long long int, long long int> > a(n);
  double num = 0, price = 2000;
  for (auto &it : a) cin >> it.first >> it.second;
  for (long long i = 0; i < n; i++) {
    long long j = (i + 1) % n;
    long long l = a[i].second / p - (a[i].first - 1) / p,
              r = a[j].second / p - (a[j].first - 1) / p,
              tl = a[i].second - a[i].first + 1,
              tr = a[j].second - a[j].first + 1;
    long long tnum = l * (tr - r) + r * (tl - l) + l * r;
    num += tnum * price / (tr * tl);
  }
  cout << num;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);
  long long t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
