#include <bits/stdc++.h>
using namespace std;
int l[100010], r[100010];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, p, i, j;
  long long x, y, X, Y;
  double answer = 0;
  cin >> n >> p;
  for (i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  for (i = 0; i < n; i++) {
    j = (i + 1) % n;
    X = (r[i] - l[i] + 1);
    Y = (r[j] - l[j] + 1);
    x = (r[i] / p) - (l[i] % p == 0 ? (l[i] / p) : (l[i] / p) + 1) + 1;
    y = (r[j] / p) - (l[j] % p == 0 ? (l[j] / p) : (l[j] / p) + 1) + 1;
    if (x < 0) x = 0;
    if (y < 0) y = 0;
    answer += (double)(x * Y + y * X - x * y) / (double)(X * Y);
  }
  answer *= 2000.0;
  cout << setprecision(15) << answer << '\n';
  return 0;
}
