#include <bits/stdc++.h>
using namespace std;
void FastIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(15);
}
int main() {
  FastIO();
  long long int a, b, i, n, p, l, r, l1, l2, r1, r2, y, x, s, e;
  double ans = 0.0;
  vector<pair<long long int, long long int> > v;
  cin >> n >> p;
  for (i = 0; i < n; i++) {
    cin >> l >> r;
    v.push_back(make_pair(l, r));
  }
  for (i = 0; i < n - 1; i++) {
    l1 = v[i].first;
    l2 = v[i + 1].first;
    r1 = v[i].second;
    r2 = v[i + 1].second;
    x = l1;
    y = r1;
    if (x % p != 0)
      s = x / p + 1;
    else
      s = x / p;
    e = y / p;
    a = (e - s + 1);
    x = l2;
    y = r2;
    if (x % p != 0)
      s = x / p + 1;
    else
      s = x / p;
    e = y / p;
    b = (e - s + 1);
    ans = ans + ((double)(1.0 * (a * (r2 - l2 + 1 - b) + b * (r1 - l1 + 1)))) /
                    ((r1 - l1 + 1) * (r2 - l2 + 1));
  }
  l1 = v[n - 1].first;
  l2 = v[0].first;
  r1 = v[n - 1].second;
  r2 = v[0].second;
  x = l1;
  y = r1;
  if (x % p != 0)
    s = x / p + 1;
  else
    s = x / p;
  e = y / p;
  a = (e - s + 1);
  x = l2;
  y = r2;
  if (x % p != 0)
    s = x / p + 1;
  else
    s = x / p;
  e = y / p;
  b = (e - s + 1);
  ans = ans + ((double)(1.0 * (a * (r2 - l2 + 1 - b) + b * (r1 - l1 + 1)))) /
                  ((r1 - l1 + 1) * (r2 - l2 + 1));
  cout << ans * 2000 << "\n";
  return 0;
}
