#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1000000000000000000;
long long mod = 1000000000;
long double pi = 3.141592653589793238;
void pls() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long mul_mod(long long a, long long b, long long m) {
  long long x = 0, y = a;
  while (b > 0) {
    if (b & 1) {
      x = (x + y) % m;
    }
    y = (y + y) % m;
    b >>= 1;
  }
  return x;
}
inline long long modu(long long val, long long modul) {
  return (val % modul + modul) % modul;
}
inline int madd(int x, int y) { return (x % mod + y % mod) % mod; }
inline int msub(int x, int y) { return (mod + x % mod - y % mod) % mod; }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long powmod(long long a, long long mod, long long p) {
  if (p == 0) return 1;
  long long res;
  long long x = powmod(a, mod, p / 2);
  res = x;
  if (p & 1) x = mul_mod(x, a, mod);
  return mul_mod(x, res, mod);
}
long long exp(long long a, long long p) {
  if (p == 0) return 1;
  long long res;
  long long x = exp(a, p / 2);
  res = x;
  if (p & 1) x = (x * a);
  return (x * res);
}
long long sqt(long long x) {
  long long l = 1LL;
  long long r = x;
  long long res;
  while (l <= r) {
    long long mid = l + (r - l) / 2;
    if (mid * mid <= x) {
      res = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  return res;
}
int di[8] = {-1, -1, -1, 1, 1, 1, 0, 0};
int dj[8] = {-1, 0, 1, -1, 0, 1, -1, 1};
int ii[4] = {0, 0, -1, 1};
int jj[4] = {-1, 1, 0, 0};
void solve() {
  int n;
  cin >> n;
  double p;
  cin >> p;
  vector<double> len(n), no(n);
  double deno = 1.0;
  for (int i = 0; i < n; i++) {
    double l, r;
    cin >> l >> r;
    len[i] = (r - l + 1.0);
    deno *= len[i];
    int fv = l / p;
    fv = fv * p;
    if (fv < l) fv += p;
    if (fv <= r)
      no[i] = (len[i] - ceil(double(r - fv + 1) / double(p)));
    else
      no[i] = len[i];
  }
  double res = 0;
  for (int i = 0; i < n; i++) {
    if (i == n - 1)
      res += ((2000.0) * (len[i] * len[0] - no[i] * no[0])) / (len[i] * len[0]);
    else
      res += ((2000.0) * (len[i] * len[i + 1] - no[i] * no[i + 1])) /
             (len[i] * len[i + 1]);
  }
  cout << fixed << setprecision(6) << res << endl;
}
int main() {
  pls();
  solve();
  return 0;
}
