#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 200;
double p[maxn];
int main() {
  int n, l, r, P;
  double ans = 0;
  scanf("%d%d", &n, &P);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &l, &r);
    p[i] = 1.0 * (r / P - (l - 1) / P) / (r - l + 1);
  }
  for (int i = 0; i < n; i++) {
    int j = (i + 1) % n;
    ans += 2000.0 * (p[i] + p[j] - p[i] * p[j]);
  }
  printf("%.10lf\n", ans);
  return 0;
}
