#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int calc(int l, int r, int p) { return r / p - (l - 1) / p; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(12);
  cout << fixed;
  int n, p;
  cin >> n >> p;
  vector<int> l(n), r(n);
  for (int i = 0; i < n; ++i) cin >> l[i] >> r[i];
  double res = 0;
  for (int k = 0; k < n; ++k) {
    int i = k;
    int j = (k + 1) % n;
    double pi = 1.0 * calc(l[i], r[i], p) / (r[i] - l[i] + 1);
    double pj = 1.0 * calc(l[j], r[j], p) / (r[j] - l[j] + 1);
    res += 2000.0 * (1 - (1 - pi) * (1 - pj));
  }
  cout << res << '\n';
  return 0;
}
