#include <bits/stdc++.h>
using namespace std;
void solve() {}
const long long maxn = 100500;
long long l[maxn], r[maxn];
signed main() {
  ios::sync_with_stdio(0);
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  if (false) cerr << fixed << setprecision(10);
  long long n, p;
  cin >> n >> p;
  for (long long i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  long double ans = 0;
  for (long long i = 0; i < n; i++) {
    long long j = (i + 1) % n;
    long long mi = (r[i] / p) - ((l[i] - 1) / p);
    long long mj = (r[j] / p) - ((l[j] - 1) / p);
    long double x = (long double)mi / (long double)(r[i] - l[i] + 1);
    long double y = (long double)mj / (long double)(r[j] - l[j] + 1);
    long double either = x + y - (x * y);
    if (false) cerr << mi << " " << mj << '\n';
    if (false) cerr << x << " " << y << " -> " << either << '\n';
    ans += 2000.0 * either;
  }
  cout << ans << '\n';
}
