#include <bits/stdc++.h>
using namespace std;
pair<int, int> pt[100005];
int main() {
  int n, p;
  scanf("%d%d", &n, &p);
  for (int i = 0; i < n; i++) scanf("%d%d", &pt[i].first, &pt[i].second);
  double ans = 0;
  for (int i = 0; i < n; i++) {
    int a = pt[i].first, b = pt[i].second;
    double cnt1 = (b / p - (a - 1) / p) * 1.0 / (b - a + 1);
    a = pt[(i + 1) % n].first, b = pt[(i + 1) % n].second;
    double cnt2 = (b / p - (a - 1) / p) * 1.0 / (b - a + 1);
    ans += 2000 * (cnt1 + cnt2 - cnt1 * cnt2);
  }
  printf("%.9lf\n", ans);
  return 0;
}
