#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, p;
  cin >> n >> p;
  vector<long double> prob(n);
  for (int i = 0; i < n; i++) {
    int l, r, cnt;
    cin >> l >> r;
    cnt = r / p - (l - 1) / p;
    prob[i] = (long double)cnt / (long double)(r - l + 1);
  }
  long double sol = 0;
  for (int i = 0; i < n; i++) {
    long double p1 = 1 - prob[i], p2 = 1 - prob[(i + 1) % n];
    sol += 2000 * (1 - p1 * p2);
  }
  cout << fixed << setprecision(6) << sol << "\n";
}
