#include <bits/stdc++.h>
void quit();
using namespace std;
const long double PI = acos(-1);
const long double EPS = 1e-10;
double __t;
int n, p;
int l[100500];
int r[100500];
int cnt[100500];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> p;
  for (int i = 0; i < n; ++i) cin >> l[i] >> r[i];
  for (int i = 0; i < n; ++i) cnt[i] = r[i] / p - (l[i] - 1) / p;
  double ans = 0;
  double proba;
  double p1, p2;
  for (int i = 0; i < n; ++i) {
    p1 = double(cnt[i]) / double(r[i] - l[i] + 1);
    p2 = double(cnt[(i + 1) % n]) / double(r[(i + 1) % n] - l[(i + 1) % n] + 1);
    proba = p1 + p2 - p1 * p2;
    ans += 2000.0 * proba;
  }
  cout << fixed << setprecision(7);
  cout << ans;
  quit();
}
void quit() { exit(0); }
