#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, p, i;
  cin >> n >> p;
  long double ans = 0;
  vector<long double> v;
  for (i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    long double num = b / p - (a - 1) / p;
    long double cnt = b - a + 1;
    v.push_back(num / cnt);
  }
  for (i = 0; i < n; i++) {
    long long int nxt = (i + 1) % n;
    double a1 = v[i];
    double a2 = v[nxt];
    ans += 2000 * (a1 + a2 - a1 * a2);
  }
  cout << setprecision(15) << fixed << ans << '\n';
  return 0;
}
