#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chkmin(T& x, U y) {
  if (y < x) x = y;
}
int n, p;
int l[100005], r[100005], len[100005];
int main() {
  cin >> n >> p;
  for (int i = 0; i < n; i++)
    scanf("%d%d", l + i, r + i), len[i] = r[i] - l[i] + 1;
  l[n] = l[0], r[n] = r[0];
  len[n] = len[0];
  double ret = 0;
  for (int i = 0; i < n; i++) {
    int x = len[i] - r[i] / p + (l[i] - 1) / p;
    int y = len[i + 1] - r[i + 1] / p + (l[i + 1] - 1) / p;
    ret += 2000.0 * (1 - 1. * x / len[i] * y / len[i + 1]);
  }
  printf("%.10lf\n", ret);
  return 0;
}
