#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;
const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, p;
  cin >> n >> p;
  double ans = 0;
  vector<pair<long long, long long>> ranges(n);
  for (long long i = 0; i < (n); ++i) {
    cin >> ranges[i].first >> ranges[i].second;
  }
  for (long long i = 0; i <= (n - 1); ++i) {
    long long l1, l2, r2, r1;
    l1 = ranges[i].first;
    r1 = ranges[i].second;
    l2 = ranges[(i + 1) % n].first;
    r2 = ranges[(i + 1) % n].second;
    long long len1 = r1 - l1 + 1;
    long long len2 = r2 - l2 + 1;
    long long v1 = (r1 / p - (long long)ceil((l1 * 1.0) / p) + 1);
    long long v2 = (r2 / p - ceil((l2 * 1.0) / p) + 1);
    double p =
        ((v1 * (len2 - v2) + v2 * (len1 - v1) + v1 * v2) * 1.0) / (len1 * len2);
    ans += p;
  }
  ans *= 2000;
  cout << fixed << setprecision(6) << ans << endl;
  return 0;
}
