#include <bits/stdc++.h>
using namespace std;
int get(int l, int r, int p) { return (r / p) - ((l - 1) / p); }
int main() {
  ios::sync_with_stdio(false);
  int n, p;
  cin >> n >> p;
  vector<int> l(n), r(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  long double ans = 0.0;
  for (int i = 0; i < n; i++) {
    int oy = get(l[i], r[i], p);
    int yo = get(l[(i + 1) % n], r[(i + 1) % n], p);
    int on = r[i] - l[i] + 1;
    int no = r[(i + 1) % n] - l[(i + 1) % n] + 1;
    long double p1 = (oy - on) * 1.0 / on;
    long double p2 = (yo - no) * 1.0 / no;
    ans += 2000.0 * (1.0 - p1 * p2);
  }
  cout << setprecision(20) << ans << endl;
  return 0;
}
