#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int mod = 1e9 + 7;
const int INF = 0x7fffffff;
const double pi = acos(-1.0);
const double eps = 1e-4;
double l[MAXN], r[MAXN];
int a, b, n, p;
double c[MAXN];
double solve() {
  c[0] = c[n];
  double ans = 0;
  for (int i = 1; i <= n; i++)
    ans += (c[i] * (1 - c[i - 1]) + c[i] * c[i - 1] + c[i - 1] * (1 - c[i]));
  return ans * 2000;
}
int main() {
  cin >> n >> p;
  for (int i = 1; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    a = y / p - (x - 1) / p;
    b = y - x + 1;
    c[i] = a * 1.0 / b;
  }
  printf("%.6lf\n", solve());
  return 0;
}
