#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
long long max3(long long a, long long b, long long c) {
  return max(max(a, b), c);
}
long long max4(long long a, long long b, long long c, long long d) {
  return max(max(a, b), max(c, d));
}
long long min3(long long a, long long b, long long c) {
  return min(min(a, b), c);
}
long long min4(long long a, long long b, long long c, long long d) {
  return min(min(a, b), min(c, d));
}
long long po(long long x, long long n, long long mod = 1000000007) {
  if (n == 0) {
    return 1;
  }
  long long m = po(x, n / 2, mod);
  m *= m;
  m %= mod;
  if (n % 2) {
    m *= x;
    m %= mod;
  }
  return m;
}
int32_t main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  clock_t startTime = clock();
  cout << fixed << setprecision(12);
  long long n, p;
  cin >> n >> p;
  vector<long long> r(n + 1), l(n + 1);
  for (long long i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  l[n] = l[0];
  r[n] = r[0];
  vector<long long> tot(n + 1), div(n + 1), non_div(n + 1);
  for (long long i = 0; i <= n; i++) {
    tot[i] = r[i] - l[i] + 1;
    div[i] = r[i] / p - (l[i] - 1) / p;
    non_div[i] = tot[i] - div[i];
  }
  long double ans = 0.0;
  for (long long i = 0; i < n; i++) {
    long double x = non_div[i] * non_div[i + 1];
    x /= tot[i] * tot[i + 1];
    ans += (1 - x);
  }
  cout << 2000 * ans << "\n";
}
