#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
long double h[300001], dp[300001][2];
long double ans = 0.0;
int main() {
  int n, p, l, r;
  scanf("%d %d", &n, &p);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &l, &r);
    int tmp = r / p - (l - 1) / p;
    h[i] = (long double)(tmp) / (r - l + 1);
  }
  for (int k = 0; k <= 1; k++) {
    if (k == 0) {
      dp[n - 1][0] = 0;
      dp[n - 1][1] = 2000;
    } else {
      dp[n - 1][0] = 2000;
      dp[n - 1][1] = 2000;
    }
    for (int i = n - 2; i >= 1; i--) {
      dp[i][0] =
          (1.0 - h[i + 1]) * dp[i + 1][0] + h[i + 1] * (dp[i + 1][1] + 2000);
      dp[i][1] = (1.0 - h[i + 1]) * (dp[i + 1][0] + 2000) +
                 h[i + 1] * (dp[i + 1][1] + 2000);
    }
    if (k == 0)
      ans +=
          (1.0 - h[n]) * ((1.0 - h[1]) * dp[1][0] + h[1] * (dp[1][1] + 2000));
    else
      ans +=
          h[n] * ((1.0 - h[1]) * (dp[1][0] + 2000) + h[1] * (dp[1][1] + 2000));
  }
  printf("%.9f\n", (double)ans);
  return 0;
}
