#include <bits/stdc++.h>
using namespace std;
bool comp(int a, int b) { return (a > b); }
int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main(void) {
  int n, p;
  cin >> n >> p;
  int l[n], r[n], i;
  long long int c, cp, l1, l2;
  double ans = 0;
  for (i = 0; i < n; ++i) cin >> l[i] >> r[i];
  for (i = 0; i < n; ++i) {
    l1 = r[i] - l[i] + 1;
    l2 = r[(i - 1 + n) % n] - l[(i - 1 + n) % n] + 1;
    c = r[i] / p - (l[i] - 1) / p;
    cp = r[(i - 1 + n) % n] / p - (l[(i - 1 + n) % n] - 1) / p;
    ans += (2000.0 * (c * l2 + cp * l1 - (c * cp))) / (l1 * l2);
  }
  printf("%.10lf", ans);
  return 0;
}
