#include <bits/stdc++.h>
using namespace std;
long long int n, p;
const long long int N = 1e5;
long long int a[N];
long long int l[N], r[N];
void input() {
  scanf("%I64d %I64d", &n, &p);
  for (long long int i = 0; i < n; i++) scanf("%I64d %I64d", &l[i], &r[i]);
}
long long int good(long long int left, long long int right) {
  long long int ans = -(left - 1) / p + right / p;
  return ans;
}
long double cal(long long int i, long long int j) {
  long long int s1 = good(l[i], r[i]);
  long long int s2 = good(l[j], r[j]);
  long long int to1 = r[i] - l[i] + 1;
  long long int to2 = r[j] - l[j] + 1;
  s1 = to1 - s1;
  s2 = to2 - s2;
  long double ans =
      (long double)(s2 * s1 + 0.00) / (long double)(to1 * to2 + 0.00);
  ans = 1.00 - ans;
  return ans;
}
void solve() {
  long double ans = 0.00;
  for (long long int i = 0; i < n; i++) {
    long long int j = (i + 1) % n;
    ans += cal(i, j) * 2000.00;
  }
  cout << fixed << setprecision(10) << ans << endl;
}
int main() {
  input();
  solve();
}
