#include <bits/stdc++.h>
using namespace std;
struct s {
  int l, r;
};
struct s ia[100001];
int main() {
  int n, p;
  int i, cnt, cnt2;
  int su, su2;
  double ans = 0;
  cin >> n >> p;
  for (i = 1; i <= n; i++) {
    cin >> ia[i].l >> ia[i].r;
  }
  ia[0] = ia[n];
  for (i = 0; i < n; i++) {
    cnt = ia[i].r - ia[i].l + 1;
    cnt2 = ia[i + 1].r - ia[i + 1].l + 1;
    su = (ia[i].r / p) - (ia[i].l - 1) / p;
    su2 = ia[i + 1].r / p - (ia[i + 1].l - 1) / p;
    ans += ((double)su / cnt * 2000 + (double)su2 / cnt2 * 2000 -
            (double)su * su2 / cnt / cnt2 * 2000);
  }
  printf("%lf", ans);
}
