#include <bits/stdc++.h>
using namespace std;
double l[100005];
double r[100005];
double n, p;
double get_ans(int i, int j) {
  int rr = (int)(r[i]) / (int)p;
  int ll = ((int)(l[i] - 1) / (int)p);
  double mult1 = rr - ll;
  rr = (int)(r[j]) / (int)p;
  ll = ((int)(l[j] - 1) / (int)p);
  double mult2 = rr - ll;
  double dist1 = r[i] - l[i] + 1;
  double dist2 = r[j] - l[j] + 1;
  double p1 = (double)(mult1) / (double)(dist1);
  double p2 = (double)(mult2) / (double)(dist2);
  return p1 + p2 - (double)(p1 * p2);
}
int main() {
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  double ans = 0.0;
  for (int i = 0; i < n - 1; i++) {
    ans += get_ans(i, i + 1);
  }
  ans += get_ans(n - 1, 0);
  cout << fixed << setprecision(7) << ans * (2000.0) << endl;
  return 0;
}
