#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y);
long long gcd(long long a, long long b);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, p;
  cin >> n >> p;
  int li, ri;
  double ans = 0;
  double temp[n];
  for (int i = 0; i < n; i++) {
    cin >> li >> ri;
    temp[i] = (double)(ri / p - (li - 1) / p) / (double)(ri - li + 1);
  }
  for (int i = 0; i < n; i++) {
    double p1 = temp[i];
    double p2 = temp[(i + 1) % n];
    ans += (1 - (1 - p1) * (1 - p2));
  }
  cout << fixed << setprecision(10) << 2000.0 * ans;
  return 0;
}
long long power(long long x, long long y) {
  long long res = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
