#include <bits/stdc++.h>
using namespace std;
struct range {
  int l, r;
};
int main() {
  int n, p;
  cin >> n >> p;
  double res = 0;
  vector<range> arr(n);
  for (int i = 0; i < n; ++i) cin >> arr[i].l >> arr[i].r;
  vector<double> P(n);
  for (int s1 = 0; s1 < n; ++s1) {
    int s2 = (s1 + 1) % n;
    long long totalNumbers1 = arr[s1].r - arr[s1].l + 1;
    long long totalNumbers2 = arr[s2].r - arr[s2].l + 1;
    long long numbersDiv1 = ((arr[s1].r / p)) - ((arr[s1].l - 1) / p);
    long long numbersDiv2 = ((arr[s2].r / p)) - ((arr[s2].l - 1) / p);
    P[s1] = ((totalNumbers1 - numbersDiv1) * (totalNumbers2 - numbersDiv2)) /
            ((double)totalNumbers2 * totalNumbers1);
  }
  for (int i = 0; i < n; ++i) {
    res += 2000.0 * (1 - P[i]);
  }
  cout << fixed << setprecision(8) << res << '\n';
}
