#include <bits/stdc++.h>
using namespace std;
long long n, p;
double ans = 1.0;
double sum = 0;
long long l[200200], r[200200];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  for (int i = 0; i < n; i++) {
    long long le = l[i] - 1;
    long long num = (r[i] / p) - (le / p);
    int nxt = i + 1;
    nxt %= n;
    long long le2 = l[nxt] - 1;
    long long num2 = (r[nxt] / p) - (le2 / p);
    ans = 1.0 - ((double)((r[i] - l[i] + 1) - num) / (double)(r[i] - l[i] + 1) *
                 (double)((r[nxt] - l[nxt] + 1) - num2) /
                 (double)(r[nxt] - l[nxt] + 1));
    sum += 2000 * ans;
  }
  cout << setprecision(10) << fixed << sum << endl;
  return 0;
}
