#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
const long long MOD = 1000000007;
long long fast_exp(long long base, long long exp, long long mod) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % mod;
    base = (base * base) % mod;
    exp /= 2;
  }
  return res;
}
int f(int y, int z, int x) {
  return max(0, z / x - (int)ceil(1.0 * y / x) + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, p;
  cin >> n >> p;
  vector<pair<int, int> > v(n);
  for (int i = 0, _i = (n); i < _i; ++i) {
    cin >> v[i].first >> v[i].second;
  }
  vector<int> ans(n);
  for (int i = 0, _i = (n); i < _i; ++i) {
    ans[i] = f(v[i].first, v[i].second, p);
  }
  long double pp = 0.0;
  for (int i = 0, _i = (n); i < _i; ++i) {
    long double p1, p2, p3;
    p1 = ((1.0 * ans[i]) / (v[i].second - v[i].first + 1));
    p2 = (1.0 * ans[(i + 1) % n] /
          (v[(i + 1) % n].second - v[(i + 1) % n].first + 1));
    p3 = p1 * p2;
    long double tt = 2000.0 * (p1 + p2 - p3);
    pp += tt;
  }
  cout << setprecision(12) << pp;
  return 0;
}
