#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const long long NINF = -INF;
const long long MAXN = 1e+6 + 8;
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};
long long n, p;
vector<pair<long long, long long> > v;
long long calc(long long i) {
  long long r = v[i].second, l = v[i].first;
  return r / p - (l - 1) / p;
}
long double prob(long long i) {
  long double x = calc(i), y = calc((i + 1) % n);
  x /= (long double)(v[i].second - v[i].first + 1);
  y /= (long double)(v[(i + 1) % n].second - v[(i + 1) % n].first + 1);
  return 1 - ((1 - x) * (1 - y));
}
void MAIN() {
  cin >> n >> p;
  for (long long i = (1); i <= (n); i++) {
    long long l, r;
    cin >> l >> r;
    v.push_back({l, r});
  }
  long double sum = 0;
  for (long long i = (0); i <= (n - 1); i++) {
    sum += prob(i);
  }
  cout << sum * 2000 << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(15);
  ;
  long long t = 1;
  while (t--) {
    MAIN();
  }
}
