#include <bits/stdc++.h>
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,tune=native")
#pragma GCC optimize("SEX_ON_THE_BEACH")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma comment(linker, "/STACK:36777216")
using namespace std;
const int MAXN = 1e5 + 228;
const long long inf = 1e9;
const long double EPS = 1e-4;
const long double PI = acos(-1);
const int mod = (int)998244353;
const int MOD9 = 1000000009;
const int a228 = 18;
const long long MOD = 1000000007;
const int maxelem = 12000000;
const int fsconst = 12000;
long long get(long long l, long long r, long long x) {
  return r / x - (l - 1) / x;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  long long n, p;
  cin >> n >> p;
  vector<pair<long long, long long>> a(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  long double ans = 0;
  for (long long i = 0; i < n; ++i) {
    long long g1 = get(a[i].first, a[i].second, p);
    long long g2 = get(a[(i + 1) % n].first, a[(i + 1) % n].second, p);
    long double fsprob = (long double)g1 / (a[i].second - a[i].first + 1);
    long double ssprib =
        (long double)g2 / (a[(i + 1) % n].second - a[(i + 1) % n].first + 1);
    ans += 2000 * (1 - (1 - fsprob) * (1 - ssprib));
  }
  cout << fixed << ans;
}
