#include <bits/stdc++.h>
using namespace std;
int mi[] = {0, -1, 0, 1, -1, 1, 1, -1};
int mj[] = {1, 0, -1, 0, 1, 1, -1, -1};
long long n, p;
long long f(long long l, long long r) {
  return (long long)(r / p) - ((l - 1) / p);
}
double calc(pair<long long, long long> A, pair<long long, long long> B) {
  long long xl = A.first;
  long long xr = A.second;
  long long xd = xr - xl + 1;
  long long qx = f(xl, xr);
  long long yl = B.first;
  long long yr = B.second;
  long long yd = yr - yl + 1;
  long long qy = f(yl, yr);
  long long q = xd * yd;
  return (double)2000.0 * (((qx * yd) + (qy * xd) - (qx * qy)) / (1.0 * q));
}
void init() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
  cout << "[FREOPEN]" << endl;
  return;
}
int main() {
  scanf("%I64d %I64d", &n, &p);
  vector<pair<long long, long long> > data;
  for (int i = 0; i < n; i++) {
    long long l, r;
    scanf("%I64d %I64d", &l, &r);
    data.push_back(make_pair(l, r));
  }
  double ans = calc(data[0], data[n - 1]);
  for (int i = 0; i < n - 1; i++) ans += calc(data[i], data[i + 1]);
  printf("%.10f\n", ans);
  return 0;
}
