#include <bits/stdc++.h>
using namespace std;
const int maxx = 2e5 + 20;
long double b1[maxx], b2[maxx];
long long a[maxx], b[maxx], c[maxx];
int main() {
  long long n, p;
  cin >> n >> p;
  for (int(i) = (0); (i) < (n); (i)++) {
    long long l, r, t1, t2;
    cin >> t1 >> t2;
    l = t1;
    r = t2;
    if (l % p) l += p - (l % p);
    r -= (l % p);
    if (l <= r) {
      a[i] = ((r - l) / p) + 1;
    }
    b[i] = (t2 - t1 + 1) - a[i];
    c[i] = a[i] + b[i];
  }
  for (int(i) = (0); (i) < (n); (i)++) {
    b1[i] = (long double)2000 * (long double)1.0 * (long double)b[i] *
            (long double)b[(i + 1) % n] /
            ((long double)c[i] * (long double)c[(i + 1) % n]);
    b1[i] = 2000.0 - b1[i];
  }
  cout << setprecision(7) << fixed;
  long double ans = (long double)0.0;
  for (int(i) = (0); (i) < (n); (i)++)
    ans += ((long double)b1[i] + (long double)b1[i]);
  cout << ans / 2;
  return 0;
}
