#include <bits/stdc++.h>
using namespace std;
int n, p, l[100010], r[100010];
double res = 0;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> p;
  for (int i = 1; i <= n; i++) cin >> l[i] >> r[i];
  l[n + 1] = l[1];
  r[n + 1] = r[1];
  for (int i = 1; i <= n; i++) {
    long long first =
        (r[i] / p - (l[i] - 1) / p) * 1LL * (r[i + 1] - l[i + 1] + 1);
    long long second =
        (r[i + 1] / p - (l[i + 1] - 1) / p) * 1LL * (r[i] - l[i] + 1);
    long long uni =
        (r[i] / p - (l[i] - 1) / p) * 1LL * (r[i + 1] / p - (l[i + 1] - 1) / p);
    long long all = (r[i] - l[i] + 1) * 1LL * (r[i + 1] - l[i + 1] + 1);
    res += 2000.0 * (first + second - uni) / all;
  }
  printf("%.8f", res);
  return 0;
}
