#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e12;
const int N = 109;
const int oo = 1e9;
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int n, m;
vector<pair<int, int> > vp;
int main() {
  cin >> n >> m;
  for (int c = 0; c < n; c++) {
    int l, r;
    cin >> l >> r;
    vp.push_back({l, r});
  }
  double ans = 0;
  for (int c = 0; c < n; c++) {
    int j = (c + 1) % (n);
    int l1 = vp[c].first, r1 = vp[c].second;
    double range1 = r1 - l1 + 1;
    int a1 = (r1 / m) - (l1 - 1) / m;
    int l2 = vp[j].first, r2 = vp[j].second;
    double range2 = r2 - l2 + 1;
    int a2 = (r2 / m) - (l2 - 1) / m;
    double t1 = (range1 - a1) / range1;
    double t2 = (range2 - a2) / range2;
    ans += (1 - t1 * t2) * 2000;
  }
  cout.precision(6);
  cout << fixed << ans << "\n";
  return 0;
}
