#include <bits/stdc++.h>
int n, p, l, r;
double dp[2][100010];
int main() {
  scanf("%d%d", &n, &p);
  double ans = 0;
  int x, y;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l, &r);
    x = (l - 1) / p;
    y = r / p;
    dp[1][i] = (double)(y - x) / (r - l + 1);
    dp[0][i] = 1 - dp[1][i];
  }
  ans += 1 - dp[0][2] * dp[0][1];
  for (int i = 2; i <= n - 1; i++) ans += 1 - dp[0][i + 1] * dp[0][i];
  ans += 1 - dp[0][1] * dp[0][n];
  printf("%.6lf", ans * 2000);
  return 0;
}
