#include <bits/stdc++.h>
using namespace std;
long long int fun(long long int x, long long int y, long long int p) {
  long long int s = x / p;
  if (x % p) s++;
  long long int e = y / p;
  return e - s + 1;
}
void solve() {
  long long int n, p;
  cin >> n >> p;
  vector<pair<long long int, long long int> > A(n);
  for (int i = 0; i < n; i++) cin >> A[i].first >> A[i].second;
  double ans = 0;
  for (int i = 0; i < n; i++) {
    long long int f = i, s = (i + 1 + n) % n;
    long long int s1 = A[f].second - A[f].first + 1,
                  s2 = A[s].second - A[s].first + 1;
    long long int a = fun(A[f].first, A[f].second, p);
    long long int b = fun(A[s].first, A[s].second, p);
    double up = (s1 - a) * 1.0 * (s2 - b);
    double d = s1 * 1.0 * s2 * 1.0;
    up = (up * 1.0) / (d * 1.0);
    double pro = 1.0 - 1.0 * up;
    ans = ans * 1.0 + pro * 2000.0;
  }
  printf("%f\n", ans);
}
int main() {
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
