#include <bits/stdc++.h>
using namespace std;
int n, p, l[100100], r[100100];
long double pr[100100];
int main() {
  scanf("%d", &n), scanf("%d", &p);
  for (int i = 0; i < n; ++i) scanf("%d", &l[i]), scanf("%d", &r[i]);
  for (int i = 0; i < n; ++i)
    pr[i] = (int(r[i] / p) - int((l[i] - 1) / p)) / (r[i] - l[i] + 1.0);
  long double out = 0;
  for (int i = 0; i < n - 1; ++i) {
    out += (pr[i] + pr[i + 1] - pr[i] * pr[i + 1]) * 2000;
  }
  out += (pr[0] + pr[n - 1] - pr[0] * pr[n - 1]) * 2000;
  cout << fixed << setprecision(15) << out;
}
