#include <bits/stdc++.h>
using namespace std;
const int inf = ~0U >> 1;
const long long INF = ~0ULL >> 1;
template <class T>
inline void read(T &n) {
  char c;
  for (c = getchar(); !(c >= '0' && c <= '9'); c = getchar())
    ;
  n = c - '0';
  for (c = getchar(); c >= '0' && c <= '9'; c = getchar()) n = n * 10 + c - '0';
}
int Pow(int base, int n, int mo) {
  if (n == 0) return 1;
  if (n == 1) return base % mo;
  int tmp = Pow(base, n >> 1, mo);
  tmp = (long long)tmp * tmp % mo;
  if (n & 1) tmp = (long long)tmp * base % mo;
  return tmp;
}
const double eps = 1e-8;
struct info {
  double l, r;
  double a, b, c;
  inline info() {}
  inline info(double _l, double _r, double _a, double _b, double _c)
      : l(_l), r(_r), a(_a), b(_b), c(_c) {}
};
struct Vector {
  int top;
  info a[100000];
  Vector() { top = 0; }
  inline int size() { return top; }
  inline void clear() { top = 0; }
  inline void push_back(const info x) { a[top++] = x; }
} dp[2], der[2];
int n;
double q, a, b, x[6100], K[6100], ans[6100];
inline double cal(info A, double x) { return A.a * x * x + A.b * x + A.c; }
bool cmp(const info &a, const info &b) {
  return a.l < b.l || a.l == b.l && a.r < b.r;
}
inline double min(const double &a, const double &b) { return a < b ? a : b; }
int main() {
  cin >> n >> q >> a >> b;
  for (int i = (1); i <= (n); ++i) cin >> x[i];
  dp[1].push_back(info(1, q, 1, -2 * x[1], x[1] * x[1]));
  der[1].push_back(info(1, q, 0, 2, -2 * x[1]));
  for (int i = (2); i <= (n); ++i) {
    int cur = i & 1, las = (i - 1) & 1;
    dp[cur].clear();
    der[cur].clear();
    int flag = 0;
    for (int j = (0); j < (der[las].size()); ++j) {
      double left = der[las].a[j].l * der[las].a[j].b + der[las].a[j].c;
      double right = der[las].a[j].r * der[las].a[j].b + der[las].a[j].c;
      if (left * right <= eps) {
        flag = 1;
        K[i] = -der[las].a[j].c / der[las].a[j].b;
        break;
      }
    }
    if (!flag) {
      double tmp = der[las].a[0].l * der[las].a[0].b + der[las].a[0].c;
      if (tmp > -eps)
        K[i] = 1 + (i - 2) * a;
      else
        K[i] = b * (i - 1);
    }
    double dpk;
    for (int j = (0); j < (dp[las].size()); ++j) {
      if (dp[las].a[j].l <= K[i]) {
        double R = min(dp[las].a[j].r, K[i]);
        if (dp[las].a[j].l + a <= q)
          dp[cur].push_back(
              info(dp[las].a[j].l + a, min(R + a, q), dp[las].a[j].a + 1,
                   -2. * dp[las].a[j].a * a + dp[las].a[j].b - 2 * x[i],
                   dp[las].a[j].a * a * a - dp[las].a[j].b * a +
                       dp[las].a[j].c + x[i] * x[i]));
      }
      if (dp[las].a[j].r >= K[i]) {
        double L = max(dp[las].a[j].l, K[i]);
        if (L + b <= q)
          dp[cur].push_back(
              info(L + b, min(dp[las].a[j].r + b, q), dp[las].a[j].a + 1,
                   -2. * dp[las].a[j].a * b + dp[las].a[j].b - 2 * x[i],
                   dp[las].a[j].a * b * b - dp[las].a[j].b * b +
                       dp[las].a[j].c + x[i] * x[i]));
      }
      if (K[i] >= dp[las].a[j].l && K[i] <= dp[las].a[j].r) {
        dpk = dp[las].a[j].a * K[i] * K[i] + dp[las].a[j].b * K[i] +
              dp[las].a[j].c;
      }
    }
    if (max(K[i] + a, (double)0) <= min(K[i] + b, q))
      dp[cur].push_back(info(max(K[i] + a, (double)0), min(K[i] + b, q), 1,
                             -2 * x[i], x[i] * x[i] + dpk));
    for (int j = (0); j < (der[las].size()); ++j) {
      if (der[las].a[j].l <= K[i]) {
        double R = min(der[las].a[j].r, K[i]);
        if (der[las].a[j].l + a <= q)
          der[cur].push_back(
              info(der[las].a[j].l + a, min(R + a, q), der[las].a[j].a,
                   -2. * der[las].a[j].a * a + der[las].a[j].b + 2,
                   der[las].a[j].a * a * a - der[las].a[j].b * a +
                       der[las].a[j].c - 2 * x[i]));
      }
      if (der[las].a[j].r >= K[i]) {
        double L = max(der[las].a[j].l, K[i]);
        if (L + b <= q)
          der[cur].push_back(
              info(L + b, min(der[las].a[j].r + b, q), der[las].a[j].a,
                   -2. * der[las].a[j].a * b + der[las].a[j].b + 2,
                   der[las].a[j].a * b * b - der[las].a[j].b * b +
                       der[las].a[j].c - 2 * x[i]));
      }
    }
    if (max(K[i] + a, (double)0) <= min(K[i] + b, q))
      der[cur].push_back(
          info(max(K[i] + a, (double)0), min(K[i] + b, q), 0, 2, -2 * x[i]));
  }
  double best = 1e30;
  for (int i = (0); i < (dp[n & 1].size()); ++i) {
    int cur = n & 1;
    if (cal(dp[cur].a[i], dp[cur].a[i].l) < best) {
      ans[n] = dp[cur].a[i].l;
      best = cal(dp[cur].a[i], dp[cur].a[i].l);
    }
    if (cal(dp[cur].a[i], dp[cur].a[i].r) < best) {
      ans[n] = dp[cur].a[i].r;
      best = cal(dp[cur].a[i], dp[cur].a[i].r);
    }
    double x = -dp[cur].a[i].b / (2 * dp[cur].a[i].a);
    if (x >= dp[cur].a[i].l && x <= dp[cur].a[i].r) {
      if (cal(dp[cur].a[i], x) < best) {
        ans[n] = x;
        best = cal(dp[cur].a[i], x);
      }
    }
  }
  for (int i = (n); i >= (2); --i) {
    if (ans[i] < K[i] + a)
      ans[i - 1] = ans[i] - a;
    else if (ans[i] > K[i] + b)
      ans[i - 1] = ans[i] - b;
    else
      ans[i - 1] = K[i];
  }
  for (int i = (1); i <= (n); ++i) printf("%.6lf ", (double)ans[i]);
  puts("");
  best = 0;
  for (int i = (1); i <= (n); ++i) best += (x[i] - ans[i]) * (x[i] - ans[i]);
  printf("%.10lf\n", (double)best);
  return 0;
}
