#include <bits/stdc++.h>
using namespace std;
int N, p;
int arr[100010];
int L[100010], R[100010];
int nxt(int i) { return (i + 1) % N; }
int prv(int i) { return (i - 1 + N) % N; }
double P[100010];
inline void ReadInput(void) {
  scanf("%d", &N);
  scanf("%d", &p);
  for (int i = 0; i < N; i++) {
    scanf("%d", &L[i]);
    scanf("%d", &R[i]);
    P[i] = (R[i] / p) - ((L[i] - 1) / p);
    P[i] /= (double)(R[i] - L[i] + 1);
  }
}
inline void solve(void) {
  double ans = 0;
  for (int i = 0; i < N; i++) {
    double add = (2000 * P[i]) + (1000 * (1 - P[i]) * (P[nxt(i)] + P[prv(i)]));
    ans += add;
  }
  printf("%.9lf\n", ans);
}
inline void Refresh(void) {}
int main() {
  ReadInput();
  solve();
  return 0;
}
