#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cout.unsetf(ios::floatfield);
  cout.precision(6);
  long int n, p, i, j, l[100000], r[100000], a[100000], cnt = 0;
  double ans = 0.0, tmp;
  scanf("%ld %ld", &n, &p);
  for (i = 0; i < n; i++) {
    scanf("%ld %ld", &l[i], &r[i]);
    a[i] = (r[i] / p) - (l[i] - 1) / p;
  }
  for (i = 0; i < n; i++) {
    tmp = 1.0;
    tmp *= (double)(r[i] - l[i] + 1 - a[i]);
    tmp /= (double)(r[i] - l[i] + 1);
    long long md = (i + 1) % n;
    tmp *= (double)(r[md] - l[md] + 1 - a[md]);
    tmp /= (double)(r[md] - l[md] + 1);
    ans -= tmp;
  }
  ans += n;
  ans *= 2000;
  cout << setprecision(7) << ans;
  return 0;
}
