#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
struct nd {
  int d, cnt;
};
nd a[maxn];
int main() {
  int n, p;
  scanf("%d%d", &n, &p);
  for (int i = 1; i <= n; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    a[i].d = r - l + 1;
    a[i].cnt = r / p - (l - 1) / p;
  }
  double ans = 0, tmp = 0;
  tmp = (1.0 * (a[1].d - a[1].cnt) / a[1].d) *
        (1.0 * (a[n].d - a[n].cnt) / a[n].d);
  tmp = 1.0 - tmp;
  ans += tmp * 2000.0;
  for (int i = 2; i <= n; i++) {
    tmp = (1.0 * (a[i - 1].d - a[i - 1].cnt) / a[i - 1].d) *
          (1.0 * (a[i].d - a[i].cnt) / a[i].d);
    tmp = 1.0 - tmp;
    ans += tmp * 2000.0;
  }
  printf("%.12f\n", ans);
  return 0;
}
