#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 50;
map<int, int> mp1;
map<int, int> mp2;
double a[MAX];
int main(int argc, char const *argv[]) {
  int n;
  long long p;
  scanf("%d%I64d", &n, &p);
  for (int i = 0; i < n; i++) {
    long long l, r;
    scanf("%I64d%I64d", &l, &r);
    int t = r / p - (l - 1) / p;
    a[i] = 1.0 - (double)t / (r - l + 1);
  }
  double ans = 0;
  for (int i = 0; i < n - 1; i++) {
    ans += (1 - a[i] * a[i + 1]) * 2000;
  }
  ans += (1 - a[0] * a[n - 1]) * 2000;
  printf("%f\n", ans);
  return 0;
}
