#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 9;
int a[MAX], b[MAX], n, p, l, r;
long double ans;
int k(int l) { return (l % n + n) % n; }
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> p;
  for (int i = 0; i < n; i++)
    cin >> l >> r, a[i] = r - l + 1, b[i] = r / p - (l - 1) / p;
  for (int i = 0; i < n; i++)
    ans +=
        (1 - (1 - 1.0 * b[i] / a[i]) * (1 - 1.0 * b[k(i + 1)] / a[k(i + 1)])) *
        2000.0;
  cout << fixed << setprecision(9) << ans;
}
