#include <bits/stdc++.h>
const int maxN = 100005;
using namespace std;
int n, p;
int sharks[maxN][2];
int getMultiple(int index) {
  return sharks[index][1] / p - (sharks[index][0] - 1) / p;
}
int main() {
  cin >> n >> p;
  for (int i = 0; i < n; ++i) {
    cin >> sharks[i][0] >> sharks[i][1];
  }
  double res = 0;
  for (int i = 0; i < n; ++i) {
    int next = (i + 1) % n;
    double total = (double)(sharks[i][1] - sharks[i][0] + 1) *
                   (sharks[next][1] - sharks[next][0] + 1);
    double lef = getMultiple(i);
    double rig = getMultiple(next);
    double avai = lef * (sharks[next][1] - sharks[next][0] + 1) +
                  rig * (sharks[i][1] - sharks[i][0] + 1);
    avai -= lef * rig;
    res += avai / total * 2000.;
  }
  cout << fixed << setprecision(6) << res << endl;
  return 0;
}
