#include <bits/stdc++.h>
using namespace std;
const int MxN = 1e5 + 10;
long long dp[MxN];
long long n, p, valids[MxN], range[MxN];
long long num_times(int i1, int i2) {
  long long ans = 1;
  if (i1 > 0) ans *= dp[i1 - 1];
  ans *= (dp[n - 1] / dp[i2]);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> p;
  double divisor = 1;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    int c1 = b / p;
    int c2 = a / p;
    valids[i] = c1 - c2;
    range[i] = b - a;
  }
  double ans = 0;
  for (int i = 0; i < n; i++) {
    double t;
    double all_curr = range[i];
    double all_next = range[(i + 1) % n];
    double curr = valids[i];
    double next = valids[(i + 1) % n];
    ans += ((curr * all_next) + ((all_curr - curr) * next)) /
           (all_curr * all_next);
  }
  ans *= 2000;
  printf("%f", ans);
  return 0;
}
