#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
const int MAXR = 1;
const int MAXC = 1;
const int INF = (int)1e+9;
int arr[MAXN][2];
double darr[MAXN];
int x4[] = {-1, 0, 1, 0};
int y4[] = {0, 1, 0, -1};
int main(void) {
  ios::sync_with_stdio(false);
  int n, p, l, r, x, y;
  cin >> n >> p;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    y = r / p;
    x = (l - 1) / p;
    arr[i][0] = r - l + 1;
    arr[i][1] = (r - l + 1) - (y - x);
    darr[i] = ((double)(arr[i][1])) / arr[i][0];
    ;
  }
  double ans = 0;
  int i = 0;
  int ni;
  do {
    ni = (i + 1) % n;
    ans += (1 - darr[i] * darr[ni]);
    i = ni;
  } while (i != 0);
  ans = ans * 2000.0;
  cout << fixed << setprecision(15) << ans;
  return 0;
}
