#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
long double p;
long double ans;
pair<long double, long double> a[N];
int main() {
  cin >> n >> p;
  int help;
  for (int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second, a[i].first--;
  long double all, good;
  for (int i = 0; i < n; ++i) {
    all = a[i].second - a[i].first;
    good = ((int)a[i].second / (int)p) - ((int)a[i].first / (int)p);
    ans += 2000.0 * (good / all);
    help = i + 1;
    if (help == n) help = 0;
    ans += 1000.0 * ((all - good) / all) *
           ((((int)a[help].second / (int)p) - ((int)a[help].first / (int)p)) /
            (a[help].second - a[help].first));
    help = i - 1;
    if (help == -1) help = n - 1;
    ans += 1000.0 * ((all - good) / all) *
           ((((int)a[help].second / (int)p) - ((int)a[help].first / (int)p)) /
            (a[help].second - a[help].first));
  }
  cout << fixed << setprecision(10) << ans;
}
