#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
struct node {
  double p0, p1;
} p[N];
double dp[N][2];
int main() {
  int n, P;
  while (~scanf("%d%d", &n, &P)) {
    for (int i = 1; i <= n; i++) {
      int l, r, len, cnt;
      scanf("%d%d", &l, &r);
      len = r - l + 1;
      cnt = len / P;
      if ((len % P) > (r % P)) cnt++;
      if (len == 0)
        p[i].p0 = 1.0, p[i].p1 = 0;
      else
        p[i].p1 = 1.0 * cnt / len, p[i].p0 = 1.0 - p[i].p1;
    }
    memset(dp, 0, sizeof(dp));
    for (int i = 2; i <= n; i++) {
      dp[i][0] = p[i - 1].p0 * dp[i - 1][0] + p[i - 1].p1 * (dp[i - 1][1] + 1);
      dp[i][1] =
          p[i - 1].p0 * (dp[i - 1][0] + 1) + p[i - 1].p1 * (dp[i - 1][1] + 1);
    }
    double ans = dp[n][0] * p[n].p0 * p[1].p0 +
                 (dp[n][0] + 1) * p[n].p0 * p[1].p1 + (dp[n][1] + 1) * p[n].p1;
    printf("%.10f\n", ans * 2000.0);
  }
  return 0;
}
