#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, p;
  long long int A[100001][2];
  long long int l, r;
  double result = 0.000000;
  cin >> n >> p;
  long long int i, start1, start2, j;
  double ans1, ans2;
  for (i = 0; i < n; i++) cin >> A[i][0] >> A[i][1];
  for (i = 0; i < n; i++) {
    j = (i + 1) % n;
    if (A[i][0] % p == 0)
      start1 = A[i][0];
    else
      start1 = (p - A[i][0] % p) + A[i][0];
    if (A[j][0] % p == 0)
      start2 = A[j][0];
    else
      start2 = (p - A[j][0] % p) + A[j][0];
    ans1 = 0, ans2 = 0;
    if (A[i][1] - start1 + 1 > 0)
      ans1 = ceil((double)(A[i][1] - start1 + 1) / (double)p);
    if (A[j][1] - start2 + 1 > 0)
      ans2 = ceil((double)(A[j][1] - start2 + 1) / (double)p);
    double elem1 = A[i][1] - A[i][0] + 1;
    double elem2 = A[j][1] - A[j][0] + 1;
    result += 2000.0000000 * ((ans1 / elem1) + (ans2 / elem2) -
                              (ans1 * ans2) / (elem1 * elem2));
  }
  printf("%.6lf\n", result);
  return 0;
}
