#include <bits/stdc++.h>
using namespace std;
double solve(vector<pair<int, int>> &val, int x, int p) {
  double ret = val[x].second / p - (val[x].first - 1) / p;
  return ret / (val[x].second - val[x].first + 1);
}
void hehe() {
  int n, p;
  cin >> n >> p;
  double ans = 0.0;
  vector<pair<int, int>> val(n);
  for (int i = 0; i < n; i++) {
    cin >> val[i].first >> val[i].second;
  }
  for (int i = 0; i < n; i++) {
    double p1 = solve(val, i, p);
    double p2 = solve(val, (i + 1) % n, p);
    ans += 2000 * (p1 + p2 - p1 * p2);
  }
  cout << setprecision(7) << fixed << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    hehe();
  }
  return 0;
}
