#include <bits/stdc++.h>
using namespace std;
int n;
long long p;
double a[100010];
double range[100010];
double sol;
int main() {
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    a[i] = (r / p) - (l / p) + (l % p == 0);
    range[i] = r - l + 1;
  }
  cout << endl;
  for (int i = 0; i < n - 1; i++) {
    double curr = ((double)(range[i] - a[i]) / (range[i] * range[i + 1])) *
                  (range[i + 1] - a[i + 1]) * 2000;
    curr = 2000 - curr;
    sol += curr;
  }
  int i = n - 1;
  double curr = (double)(range[i] - a[i]) / (range[i] * range[0]) *
                (range[0] - a[0]) * 2000;
  curr = (double)2000 - curr;
  sol += curr;
  printf("%.10lf", sol);
  return 0;
}
