#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int N, P;
long double prob[MAXN];
int main() {
  scanf("%d%d", &N, &P);
  for (int i = 0; i < N; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    prob[i] = (long double)(r / P - (l - 1) / P) / (r - l + 1);
  }
  long double sol = 0;
  for (int i = 0; i < N; i++) sol += prob[i] * (2 - prob[(i + 1) % N]);
  printf("%lf\n", (double)sol * 2000);
  return 0;
}
