#include <bits/stdc++.h>
using namespace std;
char QAQ;
bool fff;
template <class T>
inline void Read(T &k) {
  while (((QAQ = getchar()) < '0' || QAQ > '9') && QAQ != '-')
    ;
  fff = QAQ == '-';
  k = fff ? 0 : QAQ - '0';
  while ((QAQ = getchar()) >= '0' && QAQ <= '9') k = k * 10 + QAQ - '0';
  if (fff) k = -k;
}
inline void in() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
inline void out() {
  fclose(stdin);
  fclose(stdout);
}
const int MAXN = 100004;
int N, P;
int l[MAXN], r[MAXN];
int main() {
  long long cnt1, cnt2;
  long double ans = 0;
  long double tot = 1;
  Read(N), Read(P);
  for (register int i = 1; i <= N; i++) {
    Read(l[i]), Read(r[i]);
    tot *= (r[i] - l[i] + 1);
  }
  l[N + 1] = l[1], r[N + 1] = r[1];
  for (register int i = 1; i <= N; i++) {
    cnt1 = r[i] / P - (l[i] - 1) / P;
    cnt2 = r[i + 1] / P - (l[i + 1] - 1) / P;
    ans += (long double)(cnt1 * (r[i + 1] - l[i + 1] + 1) +
                         cnt2 * (r[i] - l[i] + 1 - cnt1)) /
           (r[i] - l[i] + 1) / (r[i + 1] - l[i + 1] + 1);
  }
  printf("%.10lf\n", (double)(ans * 2000));
  return 0;
}
