#include <bits/stdc++.h>
using namespace std;
pair<long long int, long long int> p[100005];
long long int s[100005], l[100005];
long double ans;
int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  long long int n, pr;
  cin >> n >> pr;
  for (int i = 1; i <= n; i++) cin >> p[i].first >> p[i].second;
  for (int i = 1; i <= n; i++) {
    long long int x = p[i].first / pr;
    if (p[i].first % pr) x++;
    long long int y = p[i].second / pr;
    s[i] = y - x + 1;
    l[i] = p[i].second - p[i].first + 1 - s[i];
  }
  for (int i = 1; i < n; i++) {
    long long int cur = s[i] * s[i + 1] + l[i] * s[i + 1] + l[i + 1] * s[i];
    ans += 1.0 * cur / (p[i].second - p[i].first + 1) /
           (p[i + 1].second - p[i + 1].first + 1);
  }
  long long int cur = s[1] * s[n] + l[1] * s[n] + l[n] * s[1];
  ans += 1.0 * cur / (p[n].second - p[n].first + 1) /
         (p[1].second - p[1].first + 1);
  cout << ans * 2000 << endl;
  return 0;
}
