#include <bits/stdc++.h>
using namespace std;
struct node {
  int l, r;
} arr[100005];
int main() {
  ios::sync_with_stdio(0);
  long long cnt, i, n, p, d, count[100005];
  cin >> n >> p;
  double pr[100005], ans;
  for (i = 0; i < n; i++) cin >> arr[i].l >> arr[i].r;
  for (i = 0; i < n; i++) {
    cnt = arr[i].r / p - (arr[i].l - 1) / p;
    pr[i] = 1.0 - (double)cnt / (double)(arr[i].r - arr[i].l + 1);
  }
  for (i = 0; i < n; i++) {
    ans += (1.0 - pr[i] * pr[(i + 1) % n]);
  }
  printf("%lf\n", ans * 2000);
}
