#include <bits/stdc++.h>
using namespace std;
double a[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  setprecision(10);
  int n, p;
  double ansf = 0;
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    int kol = r - l + 1, joz = 0;
    if (l % p != 0) l += (p - l % p);
    if (l <= r) joz = (r - l) / p + 1;
    a[i] = (double)((double)joz / (double)kol);
  }
  a[n] = a[0];
  for (int i = 0; i < n; i++) {
    ansf += (a[i] + (1 - a[i]) * a[i + 1]);
  }
  cout << setprecision(10) << fixed << ansf * (double)2000 << endl;
  return 0;
}
