#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int inf = 1e9;
const int mod = 1e9 + 7;
int l[maxn];
int r[maxn];
int main() {
  int n, p;
  cin >> n >> p;
  long double ans = 0.0;
  for (int i = 0; i < n; i++) cin >> l[i] >> r[i];
  for (int i = 0; i < n; i++) {
    int j = (i + 1) % n;
    long double e = 1.0;
    e *= (r[i] - l[i] + 1 - r[i] / p + (l[i] - 1) / p);
    e *= (r[j] - l[j] + 1 - r[j] / p + (l[j] - 1) / p);
    e /= (r[i] - l[i] + 1);
    e /= (r[j] - l[j] + 1);
    e = 1.0 - e;
    ans += e * 2000.0;
  }
  cout.precision(7);
  cout << fixed << ans << endl;
}
