#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename A>
ostream &operator<<(ostream &cout, vector<A> const &v);
template <typename A, typename B>
ostream &operator<<(ostream &cout, pair<A, B> const &p) {
  return cout << "(" << p.first << ", " << p.second << ")";
}
template <typename A>
ostream &operator<<(ostream &cout, vector<A> const &v) {
  cout << "[";
  for (int i = 0; i < v.size(); i++) {
    if (i) cout << ", ";
    cout << v[i];
  }
  return cout << "]";
}
template <typename A, typename B>
istream &operator>>(istream &cin, pair<A, B> &p) {
  cin >> p.first;
  return cin >> p.second;
}
const long long MAXN = 1e5 + 7;
void check() {
  long long n, p;
  cin >> n >> p;
  long long tot = 1, li, ri, can = 0;
  vector<long long> cn(n);
  pair<long long, long long> a[n];
  for (long long i = 0; i < n; i++) {
    cin >> li >> ri;
    a[i] = make_pair(li, ri);
    cn[i] = (ri / p - (li - 1) / p);
  }
  long double ans = 0;
  for (long long i = 0; i < n; i++) {
    long long ai = cn[i], aj = cn[(i + 1) % n];
    long long li = a[i].first, ri = a[i].second;
    long long lj = a[(i + 1) % n].first, rj = a[(i + 1) % n].second;
    long double not_p_i = (ri - li + 1.0 - ai) / (ri - li + 1.0);
    long double not_p_j = (rj - lj + 1.0 - aj) / (rj - lj + 1.0);
    long double tot_div_p = 1.0 - (not_p_i * not_p_j);
    ans += tot_div_p;
  }
  cout << setprecision(9) << fixed << ans * 2000;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    check();
  }
  return 0;
}
