#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 5;
int a[MAXN], l[MAXN], r[MAXN];
long long c[40][40];
int main() {
  for (int i = 0; i < 40; ++i) {
    c[i][0] = c[i][i] = 1;
    for (int j = 1; j < i; ++j) {
      c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
    }
  }
  int n, p;
  while (~scanf("%d%d", &n, &p)) {
    for (int i = 1; i <= n; ++i) {
      scanf("%d%d", l + i, r + i);
    }
    long double ans = 0;
    for (int i = 1; i <= n; ++i) {
      int j = i % n + 1;
      long long len1 = r[i] - l[i] + 1, len2 = r[j] - l[j] + 1;
      long long tmp1 = r[i] / p - (l[i] - 1) / p,
                tmp2 = r[j] / p - (l[j] - 1) / p;
      long double p = 1;
      p = 1 - 1.0 * (len1 - tmp1) * (len2 - tmp2) / len1 / len2;
      ans += 2000 * p;
    }
    printf("%.10f\n", (double)ans);
  }
  return 0;
}
