#include <bits/stdc++.h>
using namespace std;
long long a[100010], b[100010], p[100010];
int main(void) {
  int n, pr;
  cin >> n >> pr;
  double cons = 2000.00000000000000f;
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
    p[i] = (b[i]) / pr - (a[i] - 1ll) / pr;
  }
  double ans = 0.0f;
  for (int i = 0; i < n; ++i) {
    double den =
        (double)(b[i] - a[i] + 1ll) * (b[(i + 1) % n] - a[(i + 1) % n] + 1ll);
    double num = (double)(p[i] * (b[(i + 1) % n] - a[(i + 1) % n] + 1ll -
                                  p[(i + 1) % n]) +
                          p[(i + 1) % n] * (b[i] - a[i] + 1ll - p[i]) +
                          p[i] * p[(i + 1) % n]);
    ans += num / den;
  }
  ans *= cons;
  cout << fixed << setprecision(9) << ans;
  return 0;
}
