#include <bits/stdc++.h>
using namespace std;
struct IO {
  inline long long read() {
    long long sum = 0, ff = 1;
    char ch = getchar();
    while (!isdigit(ch)) {
      if (ch == '-') ff = -1;
      ch = getchar();
    }
    while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
    return sum * ff;
  }
  inline void write(long long x) {
    if (x < 0) putchar('-'), x = -x;
    if (x > 9) write(x / 10);
    putchar(x % 10 + 48);
  }
  inline void writeln(long long x) {
    write(x);
    putchar('\n');
  }
} fast;
struct nood {
  long long sum, len;
};
nood a[100005];
long long n, m, p;
double ans, now;
signed main() {
  n = fast.read();
  p = fast.read();
  for (long long i = 1; i <= n; i++) {
    long long x = fast.read();
    long long y = fast.read();
    a[i].sum = y / p - (x - 1) / p;
    a[i].len = y - x + 1;
  }
  for (long long i = 1; i < n; i++) {
    long long sumx = a[i].sum * a[i + 1].len;
    long long sumy = a[i + 1].sum * (a[i].len - a[i].sum);
    ans += (double)(sumx + sumy) * (double)2000 /
           (double)(a[i].len * a[i + 1].len);
  }
  long long sumx = a[n].sum * a[1].len;
  long long sumy = a[1].sum * (a[n].len - a[n].sum);
  ans += (double)(sumx + sumy) * (double)2000 / (double)(a[n].len * a[1].len);
  printf("%.12lf\n", ans);
  return 0;
}
