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