#include <bits/stdc++.h>
using namespace std;
bool solve() {
  ;
  int n, a;
  scanf("%d %d", &n, &a);
  double sum = 0;
  pair<int, int> p[100005];
  for (int i = 0; i < n; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    p[i] = make_pair(l, r);
  }
  for (int i = 0; i < n; i++) {
    long long aa =
        (p[i].second - p[i].first + 1) - p[i].second / a + (p[i].first - 1) / a;
    long long bb = (p[(i + 1) % n].second - p[(i + 1) % n].first + 1) -
                   p[(i + 1) % n].second / a + (p[(i + 1) % n].first - 1) / a;
    long long tot = (p[i].second - p[i].first + 1);
    tot *= (p[(i + 1) % n].second - p[(i + 1) % n].first + 1);
    sum += (1 - aa * bb * 1.0 / tot) * 2000;
  }
  printf("%.12f\n", sum);
  return true;
}
int main() {
  int t = 1;
  00000;
  while (t--) solve();
}
