#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const long long inf = 1e17;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (a == 1) return 1;
  long long x = power(a, b / 2);
  if (b % 2 == 0)
    return (x * x) % mod;
  else
    return (a * ((x * x) % mod)) % mod;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(10) << fixed;
  long long n, p;
  cin >> n >> p;
  long double L[n], R[n];
  for (long long i = 0; i < n; i++) {
    cin >> L[i] >> R[i];
  }
  long double prob[n];
  long long x1, x2;
  for (long long i = 0; i < n; i++) {
    x1 = 0, x2 = 0;
    x1 = (L[i] - 1) / p;
    x2 = R[i] / p;
    prob[i] = (x2 - x1) / (R[i] - L[i] + 1);
  }
  long double ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += (2000) * (prob[i] + prob[(i + 1) % n] - prob[i] * prob[(i + 1) % n]);
  }
  cout << ans << '\n';
}
