#include <bits/stdc++.h>
using namespace std;
long long n, p, arr[100005];
long long l1, r1, pr, l2, r2, cnt1, cnt2;
pair<long long, long long> brr[100005];
double prob, amt, sum, x1, x2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> p;
  sum = 0;
  for (long long i = (long long)(1); i <= (long long)(n); i++)
    cin >> brr[i].first >> brr[i].second;
  for (long long i = (long long)(1); i <= (long long)(n); i++) {
    if (i == 1)
      pr = n;
    else
      pr = i - 1;
    l1 = brr[i].first;
    r1 = brr[i].second;
    x1 = r1 - l1 + 1;
    l2 = brr[pr].first;
    r2 = brr[pr].second;
    x2 = r2 - l2 + 1;
    cnt1 = r1 / p - (l1 - 1) / p;
    cnt2 = r2 / p - (l2 - 1) / p;
    double t1 = (x1 - cnt1) / x1;
    double t2 = (x2 - cnt2) / x2;
    prob = 1 - t1 * t2;
    amt = prob * 2000;
    sum += amt;
  }
  printf("%.9f\n", sum);
  return 0;
}
