#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int p;
  cin >> p;
  vector<double> pp(n);
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    double len = y - x + 1.0;
    pp[i] = (y / p - (x - 1) / p) / len;
  }
  double ans = 0;
  for (int i = 0; i + 1 < n; ++i)
    ans += 2000 * (pp[i] + pp[i + 1] - pp[i] * pp[i + 1]);
  ans += 2000 * (pp[0] + pp[n - 1] - pp[0] * pp[n - 1]);
  cout.precision(12);
  cout << fixed << ans;
  return 0;
}
