#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  long n, p;
  cin >> n >> p;
  pair<long, long> info[n];
  for (int i = 0; i < n; i++) {
    long x, y;
    cin >> x >> y;
    info[i] = make_pair(x, y);
  }
  double ans = 0;
  for (int i = 0; i < n; i++) {
    int x, y;
    if (i == n - 1) {
      x = 0;
      y = n - 1;
    } else {
      x = i;
      y = x + 1;
    }
    pair<long, long> p1 = info[x];
    pair<long, long> p2 = info[y];
    long long amount1 = p1.second / p - (p1.first - 1) / p;
    long long amount2 = p2.second / p - (p2.first - 1) / p;
    long long size1 = p1.second - p1.first + 1;
    long long size2 = p2.second - p2.first + 1;
    ans += ((double)size1 * amount2 + size2 * amount1 - amount1 * amount2) *
           2000 / size1 / size2;
  }
  printf("%.12f", ans);
  return 0;
}
