#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long n, p, l[200005], r[200005];
double ans;
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++) {
    int j = (i + 1) % n;
    double numi = r[i] - l[i] + 1, divi = floor(r[i] / p - (l[i] - 1) / p);
    double proi = 1 - divi / numi;
    double numj = r[j] - l[j] + 1, divj = floor(r[j] / p - (l[j] - 1) / p);
    double proj = 1 - divj / numj;
    double pro = 1.0 - (proi * proj);
    ans += (2000.0 * pro);
  }
  cout << setprecision(20) << ans;
}
