#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const long long INF = -(long long)1e10;
int cnt_div(int l, int r, int n) {
  int low = l + (n - (l % n)) % n;
  int high = r - (r % n);
  return (max(0, ((high - low) / n) + 1));
}
int main() {
  int n, p;
  cin >> n >> p;
  double ans = 0.0;
  int l, r;
  cin >> l >> r;
  double p1 = (1.0 * cnt_div(l, r, p)) / (r - l + 1);
  double prev = p1;
  for (int i = 0; i < n - 1; i++) {
    int s, e;
    cin >> s >> e;
    double pr = (1.0 * cnt_div(s, e, p)) / (e - s + 1);
    ans += (2000 * (prev + pr - (prev * pr)));
    prev = pr;
  }
  ans += 2000 * (prev + p1 - (prev * p1));
  cout << setprecision(16) << ans << endl;
}
