#include <bits/stdc++.h>
using namespace std;
int Scan() {
  int res = 0, ch, flag = 0;
  if ((ch = getchar()) == '-')
    flag = 1;
  else if (ch >= '0' && ch <= '9')
    res = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9') res = res * 10 + ch - '0';
  return flag ? -res : res;
}
void Out(int a) {
  if (a > 9) Out(a / 10);
  putchar(a % 10 + '0');
}
int n, p;
int l[100005], r[100005];
int main() {
  while (scanf("%d%d", &n, &p) == 2) {
    for (int i = 0; i < n; i++) {
      l[i] = Scan();
      r[i] = Scan();
    }
    double res = 0.0;
    for (int i = 0; i < n; i++) {
      int j = i + 1;
      if (j >= n) j = 0;
      double p1 = 1.0 * (r[i] / p - (l[i] - 1) / p) / (r[i] - l[i] + 1);
      double p2 = 1.0 * (r[j] / p - (l[j] - 1) / p) / (r[j] - l[j] + 1);
      res += (p1 + p2 - p1 * p2) * 2000;
    }
    printf("%.6f\n", res);
  }
  return (0);
}
