#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long inf = (long long)1e18;
const int infint = (int)2e9;
const int MAXN = (int)2e5 + 10;
int l[MAXN], r[MAXN];
long long f(long long l, long long r, long long x) {
  return r / x - (l - 1) / x;
}
int main() {
  long long n, p;
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  long double expected = 0;
  for (int i = 0; i < n; i++) {
    int j = i - 1;
    if (j == -1) j = n - 1;
    long long len_i = r[i] - l[i] + 1;
    long long len_j = r[j] - l[j] + 1;
    long long ans = (f(l[i], r[i], p) * len_j + f(l[j], r[j], p) * len_i -
                     f(l[i], r[i], p) * f(l[j], r[j], p));
    long double prob = 1.0 * ans;
    prob = prob / ((1.0) * len_i);
    prob = prob / ((1.0) * len_j);
    expected += prob;
  }
  cout << fixed << setprecision(9) << 2000 * expected;
}
