#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100100;
pair<int, int> segm[MAX_N];
int GetCount(int l, int p) { return l / p; }
int GetCount(int l, int r, int p) {
  return GetCount(r, p) - GetCount(l - 1, p);
}
int main() {
  int n, p;
  scanf("%d %d", &n, &p);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &segm[i].first, &segm[i].second);
  }
  segm[n] = segm[0];
  double answer = 0;
  for (int i = 0; i < n; ++i) {
    long long cnt1 = GetCount(segm[i].first, segm[i].second, p);
    long long size1 = segm[i].second - segm[i].first + 1;
    long long cnt2 = GetCount(segm[i + 1].first, segm[i + 1].second, p);
    long long size2 = segm[i + 1].second - segm[i + 1].first + 1;
    answer +=
        (double)(cnt1 * size2 + cnt2 * size1 - cnt1 * cnt2) / (size1 * size2);
  }
  printf("%.10lf", 2000 * answer);
  return 0;
}
