#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double E = exp(1);
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
template <typename T>
inline T sqr(T n) {
  return n * n;
}
inline double hypot(double x, double y) { return sqrt(sqr(x) + sqr(y)); }
template <typename T>
inline T pmod(T n, T m) {
  return ((n % m) + m) % m;
}
template <typename T>
T power(T n, int p) {
  return (p == 0) ? (T)(1) : (sqr(power(n, p >> 1)) * ((p & 1) * (n - 1) + 1));
}
template <typename T>
T bigmod(T n, int p, T m) {
  return (p == 0)
             ? (T)(1)
             : ((sqr(bigmod(n, p >> 1, m)) % m) * ((p & 1) * (n - 1) % m + 1)) %
                   m;
}
vector<pair<long long, long long> > inp;
vector<pair<long long, long long> > ara;
int main() {
  int a, b, p;
  int n;
  while (scanf("%d %d", &n, &p) == 2) {
    ara.clear();
    for (int i = 1; i <= n; i++) {
      scanf("%d %d", &a, &b);
      int ok = b / p - (a - 1) / p;
      int baki = (b - a + 1);
      ara.push_back(make_pair(ok, baki));
    }
    double ans = 0;
    long long tmp, tt;
    ara.push_back(ara[0]);
    for (int i = 0; i < n; ++i) {
      ans += ((1.0 * ara[i].first * ara[i + 1].second) +
              (1.0 * ara[i + 1].first * ara[i].second) -
              (ara[i].first * ara[i + 1].first)) /
             (ara[i].second * ara[i + 1].second);
    }
    printf("%.12lf\n", ans * 2000);
  }
  return 0;
}
