#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long double n, p, l, r;
  cin >> n >> p;
  long double ans = 0;
  vector<pair<long double, long double> > vp;
  for (long long int i = 1; i <= n; ++i) {
    cin >> l >> r;
    vp.push_back(make_pair(l, r));
  }
  long long temp = (long long)n;
  for (long long int i = 0; i <= n - 1; ++i) {
    pair<long double, long double> p1 = vp[i], p2 = vp[(i + 1) % temp];
    long double space1 = p1.second - p1.first + 1;
    long double primes1 = (long long)p1.second / (long long)p -
                          (long long)(p1.first - 1) / (long long)p;
    long double space2 = p2.second - p2.first + 1;
    long long primes2 = (long long)p2.second / (long long)p -
                        (long long)(p2.first - 1) / (long long)p;
    long double prob =
        2000 * (1 - (1 - primes1 / space1) * (1 - primes2 / space2));
    ans += prob;
  }
  cout << fixed << setprecision(6) << ans << endl;
  return 0;
}
