#include <bits/stdc++.h>
using namespace std;
int l[100005], r[100005], a[100005];
int main() {
  int n, p, i;
  double p2;
  double ans = 0;
  scanf("%d%d", &n, &p);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &r[i]);
    a[i] = r[i] / p - l[i] / p;
    if (l[i] % p == 0) a[i]++;
  }
  for (i = 1; i <= n - 1; i++) {
    p2 = (double)(r[i] - l[i] + 1 - a[i]) *
         (r[i + 1] - l[i + 1] + 1 - a[i + 1]) /
         ((double)(r[i] - l[i] + 1) * (r[i + 1] - l[i + 1] + 1));
    ans += ((1 - p2) * 2000);
  }
  p2 = (double)(r[1] - l[1] + 1 - a[1]) * (r[n] - l[n] + 1 - a[n]) /
       ((double)(r[1] - l[1] + 1) * (r[n] - l[n] + 1));
  ans += ((1 - p2) * 2000);
  printf("%f\n", ans);
  return 0;
}
