#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > v;
int main() {
  long long i, j, k, l, n, m;
  scanf("%lld%lld", &n, &m);
  double gun = 1.00;
  for (i = 1; i <= n; i++) {
    scanf("%lld%lld", &k, &l);
    v.push_back({k, l});
  }
  double sum = 0;
  for (i = 0; i < n; i++) {
    if (i != n - 1) {
      long long fuse = (v[i].first + m - 1) / m;
      long long suse = (v[i].second) / m;
      double temp1 = (suse - fuse + 1) * (v[i + 1].second - v[i + 1].first + 1);
      long long fuse1 = (v[i + 1].first + m - 1) / m;
      long long suse1 = (v[i + 1].second) / m;
      double temp2 = (suse1 - fuse1 + 1) * (v[i].second - v[i].first + 1);
      double temp3 = (suse1 - fuse1 + 1) * (suse - fuse + 1);
      sum = (sum + (2000.000 * (temp1 + temp2 - temp3)) /
                       (double)((v[i + 1].second - v[i + 1].first + 1) *
                                (v[i].second - v[i].first + 1)));
    } else {
      long long fuse = (v[i].first + m - 1) / m;
      long long suse = (v[i].second) / m;
      double temp1 = (suse - fuse + 1) * (v[0].second - v[0].first + 1);
      long long fuse1 = (v[0].first + m - 1) / m;
      long long suse1 = (v[0].second) / m;
      double temp2 = (suse1 - fuse1 + 1) * (v[i].second - v[i].first + 1);
      double temp3 = (suse1 - fuse1 + 1) * (suse - fuse + 1);
      sum = (sum + (2000.0000 * (temp1 + temp2 - temp3)) /
                       (double)((v[0].second - v[0].first + 1) *
                                (v[i].second - v[i].first + 1)));
    }
  }
  printf("%.10lf\n", sum);
}
