#include <bits/stdc++.h>
using namespace std;
int n, p;
int total[100010], good[100010];
int div(int x) { return x / p; }
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> p;
  double ans = 0;
  for (int i = 1; i <= n; ++i) {
    int l, r;
    cin >> l >> r;
    total[i] = r - l + 1;
    good[i] = div(r) - div(l - 1);
  }
  for (int i = 1; i <= n; ++i) {
    int ii = (i != n ? i + 1 : 1);
    ans += 1 - (1 - (1.0 * good[i] / total[i])) *
                   (1 - (1.0 * good[ii] / total[ii]));
  }
  cout << fixed << setprecision(9) << ans * 2000;
}
