#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
int main() {
  int n, p;
  scanf("%d", &n);
  scanf("%d", &p);
  int total1, total2, num1, num2;
  int l, r;
  scanf("%d", &l);
  scanf("%d", &r);
  int total = total1 = r - l + 1;
  int num = num1 = (total - (r / p - (l - 1) / p));
  double ans = 0;
  for (int i = 2; i <= n; i++) {
    scanf("%d", &l);
    scanf("%d", &r);
    total2 = r - l + 1;
    num2 = total2 - (r / p - (l - 1) / p);
    ans += 1.0 * (1 - num1 * 1.0 / total1 * num2 * 1.0 / total2) * 2000;
    num1 = num2;
    total1 = total2;
  }
  ans += 1.0 * (1 - num1 * 1.0 / total1 * num * 1.0 / total) * 2000;
  printf("%.10lf\n", ans);
  return 0;
}
