#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
int nextInt() {
  int n;
  scanf("%d", &n);
  return n;
}
long long nextLong() {
  long long n;
  scanf("%lld", &n);
  return n;
}
const double PI = acos(-1.0);
const double EPS = 1e-6;
const int INF = (int)2e9;
int l[(int)1e5 + 9], r[(int)1e5 + 9];
int main() {
  int n, p;
  scanf("%d %d", &n, &p);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &l[i], &r[i]);
  }
  double res = 0.0;
  for (int i = 0; i < n; ++i) {
    int cnt1 = r[i] / p - (l[i] - 1) / p;
    int cnt2 = r[(i + 1) % n] / p - (l[(i + 1) % n] - 1) / p;
    double p1 = (double)cnt1 / (r[i] - (l[i] - 1));
    double p2 = (double)cnt2 / (r[(i + 1) % n] - (l[(i + 1) % n] - 1));
    res += 2000 * (p1 * p2 + (p1 * (1.0 - p2)) + ((1.0 - p1) * p2));
  }
  printf("%.12lf\n", res);
  return 0;
}
