#include <bits/stdc++.h>
using namespace std;
int n, p;
const int maxn = 100005;
double prob[maxn];
double calc(long long l, long long r) {
  int g = r / p;
  int d = l / p;
  int t = bool(!(l % p));
  return ((g - d) * 1. + t) / (r - l + 1);
}
int main() {
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    long long l, r;
    cin >> l >> r;
    prob[i] = calc(l, r);
  }
  double ans = 0;
  for (int i = 0; i < n - 1; i++) {
    ans += prob[i] * prob[i + 1] * 2000;
    ans += prob[i] * (1 - prob[i + 1]) * 2000;
    ans += (1 - prob[i]) * prob[i + 1] * 2000;
  }
  ans += prob[n - 1] * prob[0] * 2000;
  ans += prob[n - 1] * (1 - prob[0]) * 2000;
  ans += (1 - prob[n - 1]) * prob[0] * 2000;
  printf("%.12lf\n", ans);
  return 0;
}
