#include <bits/stdc++.h>
using namespace std;
long long fun(long long l, long long r, long long p) {
  return r / p - (l - 1) / p;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  {
    long long n, p;
    cin >> n >> p;
    long long l[n], r[n];
    for (long long i = 0; i < n; i++) cin >> l[i] >> r[i];
    long double ans = 0, a, b, s1, s2, s, c;
    for (long long i = 0; i < n; i++) {
      a = fun(l[i], r[i], p);
      b = fun(l[(i + 1) % n], r[(i + 1) % n], p);
      s1 = r[i] - l[i] + 1;
      s2 = r[(i + 1) % n] - l[(i + 1) % n] + 1;
      ans += (a * s2 + b * s1 - a * b) / (s1 * s2);
    }
    ans *= 2000.0;
    cout << setprecision(8) << fixed << ans << '\n';
  }
  cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
  return 0;
}
