#include <bits/stdc++.h>
using namespace std;
long long X[1000009], Y[1000009], P, N, visit[200009][5][5];
double XX[1000009], YY[1000009], dp[200009][5][5];
double get(int curr) {
  long long first, second;
  first = X[curr];
  first /= P;
  first *= P;
  if (first < X[curr]) first += P;
  second = Y[curr];
  second /= P;
  second *= P;
  if (first > second) return 0;
  return (second - first) / P + 1;
}
double check(int curr, int prev, int fir) {
  double prob = get(curr) / (YY[curr] - XX[curr] + 1);
  if (curr == N) {
    if (fir)
      return 2000;
    else {
      if (prev == 0)
        return 0;
      else
        return 2000;
    }
  }
  if (visit[curr][prev][fir]) return dp[curr][prev][fir];
  visit[curr][prev][fir] = 1;
  if (curr == 0)
    return dp[curr][prev][fir] = prob * check(curr + 1, 1, 1) +
                                 (1 - prob) * check(curr + 1, 0, 0);
  if (prev)
    return dp[curr][prev][fir] = (1 - prob) * (2000 + check(curr + 1, 0, fir)) +
                                 prob * (2000 + check(curr + 1, 1, fir));
  else
    return dp[curr][prev][fir] = (1 - prob) * (check(curr + 1, 0, fir)) +
                                 prob * (2000 + check(curr + 1, 1, fir));
}
int main() {
  long long i, j, k, l, n, p;
  double ans = 0.0, first, second;
  cin >> n >> p;
  N = n;
  P = p;
  for (i = 1; i <= n; i++) {
    cin >> X[i] >> Y[i];
    XX[i] = X[i];
    YY[i] = Y[i];
  }
  XX[0] = XX[n];
  X[0] = X[n];
  YY[0] = YY[n];
  Y[0] = Y[n];
  ans = check(0, 0, 0);
  cout << setprecision(10) << fixed << ans << endl;
}
