#include <bits/stdc++.h>
using namespace std;
vector<int> L, R, cnt;
int main() {
  long double res = 0;
  int n, p;
  scanf("%d%d", &n, &p);
  L.resize(n), R.resize(n), cnt.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &L[i], &R[i]);
    cnt[i] = R[i] / p - (L[i] - 1) / p;
  }
  for (int i = 0; i < n; i++) {
    int nxt = (i + 1) % n;
    long double p1 = cnt[i] * 1.0 / (R[i] - L[i] + 1);
    long double p2 = cnt[nxt] * 1.0 / (R[nxt] - L[nxt] + 1);
    res = res + 2000 * (p1 + p2 - p1 * p2);
  }
  cout << setprecision(10) << fixed << res << endl;
  return 0;
}
