#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, p;
  cin >> n >> p;
  vector<long long> c(n);
  vector<long long> d(n);
  for (long long i = 0; i < n; i++) {
    long long l, r;
    cin >> l >> r;
    c[i] = r - l + 1;
    if (l % p != 0) {
      l += p - l % p;
      if (l <= r)
        d[i] = 1 + (r - l) / p;
      else
        d[i] = 0;
    } else {
      d[i] = 1 + (r - l) / p;
    }
  }
  double ans = 0;
  for (int i = 0; i < n; i++) {
    double c1 = ((c[i] - d[i]) / (double)c[i]);
    double c2 = ((c[(i + 1) % n] - d[(i + 1) % n]) / (double)c[(i + 1) % n]);
    ans += 1 - (c1 * c2);
  }
  cout << setprecision(15) << ans * 2000 << endl;
}
