#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n;
  double p;
  cin >> n >> p;
  pair<double, double> arr[n];
  long long range[n];
  double ans = 0, per = 1;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
    long long r, l;
    r = (long long)(arr[i].second / p) * p;
    l = (long long)(arr[i].first / p) * p;
    while (l < arr[i].first) l += p;
    if (l > r) {
      range[i] = 0;
      continue;
    }
    l /= p;
    r /= p;
    range[i] = r - l + 1;
  }
  for (int i = 0; i < n; i++) {
    if (i != n - 1) {
      double l = arr[i].first, r = arr[i].second;
      double lj = arr[i + 1].first, rj = arr[i + 1].second;
      double ai = range[i];
      double aj = range[i + 1];
      ans += 2000 * (1 - ((r - l + 1 - ai) * (rj - lj + 1 - aj) /
                          ((r - l + 1) * (rj - lj + 1))));
    } else {
      double l = arr[i].first, r = arr[i].second;
      double lj = arr[0].first, rj = arr[0].second;
      double ai = range[i];
      double aj = range[0];
      ans += 2000 * (1 - ((r - l + 1 - ai) * (rj - lj + 1 - aj) /
                          ((r - l + 1) * (rj - lj + 1))));
    }
  }
  cout << fixed << setprecision(12) << ans << endl;
  return 0;
}
