#include <bits/stdc++.h>
using namespace std;
void solve(void);
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
void solve(void) {
  int n, p;
  cin >> n >> p;
  vector<double> arr(n);
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    int lRange = l / p;
    int rRange = r / p;
    int space = rRange - lRange;
    if (l % p == 0) space++;
    double prob = ((double)(space)) / ((double)(r - l + 1));
    arr[i] = 1.0 - prob;
  }
  double prob = 0.0;
  for (int i = 0; i < n; i++) {
    int x = i;
    int y = (i + 1) % n;
    double tmp = 1.0 - (arr[x] * arr[y]);
    prob += tmp;
  }
  double ans = 2000.00 * prob;
  cout << fixed << setprecision(12) << ans << endl;
}
