#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, pair<long long, long long> > > v;
int main() {
  int n;
  long long p, l, r, tot, x1, x2;
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    tot = r - l + 1;
    if (r < p)
      v.push_back(make_pair(tot, make_pair(0, tot)));
    else {
      x1 = floor((l - 1) / p);
      x2 = floor(r / p);
      v.push_back(make_pair(tot, make_pair(x2 - x1, tot - x2 + x1)));
    }
  }
  double cnt1 = (v[n - 1].second.second) / ((v[n - 1].first) * 1.0);
  double cnt2 = (v[0].second.second) / ((v[0].first) * 1.0);
  double ans = 1 - (cnt1 * cnt2);
  for (int i = 0; i < n - 1; i++) {
    cnt1 = (v[i].second.second) / ((v[i].first) * 1.0);
    cnt2 = (v[i + 1].second.second) / ((v[i + 1].first) * 1.0);
    ans += 1 - (cnt1 * cnt2);
  }
  printf("%.6lf\n", ans * 2000);
  return 0;
}
