#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 1e5 + 5;
LL x[N], y[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, p;
  cin >> n >> p;
  for (int i = 0; i < n; ++i) {
    LL a, b;
    cin >> a >> b;
    y[i] = b - a + 1;
    LL cnt = b / p - (a - 1) / p;
    x[i] = y[i] - cnt;
  }
  x[n] = x[0];
  y[n] = y[0];
  double s = 0;
  for (int i = 0; i < n; ++i) {
    s += 1.0 - x[i] * x[i + 1] * 1.0 / (y[i] * y[i + 1]);
  }
  cout << setprecision(8) << s * 2000 << endl;
}
