#include <bits/stdc++.h>
using namespace std;
long long arr[100000], arr2[100000];
double mon = 1000.00;
long long getmul(long long x, long long y, long long p) {
  long long low, high;
  if (x % p == 0)
    low = x / p;
  else
    low = (x / p) + 1;
  high = y / p;
  if (high < low) return 0;
  return high - low + 1;
}
int main() {
  long long n, p;
  cin >> n >> p;
  long long x, y;
  for (long long i = 0; i < n; i++) {
    cin >> x >> y;
    arr[i] = getmul(x, y, p);
    arr2[i] = y - x + 1;
  }
  double ans = 0, ans1;
  ans1 = (arr2[0] - arr[0]) * (arr2[n - 1] - arr[n - 1]);
  ans1 /= (arr2[0] * arr2[n - 1]);
  ans1 = 1 - ans1;
  ans += 2000 * ans1;
  for (long long i = 0; i < n - 1; i++) {
    ans1 = (arr2[i] - arr[i]) * (arr2[i + 1] - arr[i + 1]);
    ans1 /= (arr2[i] * arr2[i + 1]);
    ans1 = 1 - ans1;
    ans += 2000 * ans1;
  }
  printf("%.10f\n", ans);
}
