#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
pair<long long int, long long int> a[100005];
long long int d[100005];
long long int b[100005];
double ans;
int main() {
  int n;
  long long int p;
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    b[i] = a[i].second / p - (a[i].first - 1) / p;
    d[i] = a[i].second - a[i].first + 1;
  }
  double prz = 2000.0;
  for (int i = 0; i < n; i++) {
    int j = (i + 1) % n;
    double p1 = (b[i] * prz) / d[i];
    double p2 = (b[j] * prz) / d[j];
    double p3 = (b[i] * b[j] * prz) / (d[i] * d[j]);
    double add = p1 + p2 - p3;
    ans += add;
  }
  printf("%.6lf\n", ans);
  return 0;
}
