#include <bits/stdc++.h>
using namespace std;
struct tree {
  long double l, r, a, b, c, dx, da, db, dc;
  int fa, son[2];
  void clear() { a = b = c = dx = da = db = dc = 0; }
};
const long double maxlong = 1e18;
const long double eps = 1e-10;
const int N = int(3e5) + 5;
long long x[N];
tree tr[N << 1];
long double poi[N], ans[N];
int tot;
int n, q, a, b, root;
int tp[N], dr[N];
void Init() {
  scanf("%d%d%d%d", &n, &q, &a, &b);
  for (int i = 1; i <= n; i++) scanf("%I64d", &x[i]);
}
long double get(long double xx, int x) {
  return (tr[x].a * xx + tr[x].b) * xx + tr[x].c;
}
pair<long double, long double> get_min(int x) {
  if (tr[x].r > q) tr[x].r = q;
  if (tr[x].l > tr[x].r) return pair<long double, long double>(0, maxlong);
  long double xx = tr[x].b / (-2 * tr[x].a);
  if (tr[x].l - eps <= xx && xx <= tr[x].r + eps)
    return pair<long double, long double>(xx, get(xx, x));
  if (get(tr[x].l, x) < get(tr[x].r, x))
    return pair<long double, long double>(tr[x].l, get(tr[x].l, x));
  else
    return pair<long double, long double>(tr[x].r, get(tr[x].r, x));
}
void trans(int x, long double d) {
  long double a(tr[x].a), b(tr[x].b), c(tr[x].c);
  tr[x].b -= 2 * a * d;
  tr[x].c += a * d * d - b * d;
  long double da(tr[x].da), db(tr[x].db), dc(tr[x].dc);
  tr[x].db -= 2 * da * d;
  tr[x].dc += da * d * d - db * d;
  tr[x].l += d;
  tr[x].r += d;
  tr[x].dx += d;
}
void add(int x, long double a, long double b, long double c) {
  tr[x].a += a;
  tr[x].b += b;
  tr[x].c += c;
  tr[x].da += a;
  tr[x].db += b;
  tr[x].dc += c;
}
void down(int x) {
  int l = tr[x].son[0], r = tr[x].son[1];
  if (l) trans(l, tr[x].dx);
  if (r) trans(r, tr[x].dx);
  tr[x].dx = 0;
  add(l, tr[x].da, tr[x].db, tr[x].dc);
  add(r, tr[x].da, tr[x].db, tr[x].db);
  tr[x].da = tr[x].db = tr[x].dc = 0;
}
int find_min(int x) {
  down(x);
  long double xx = tr[x].b / (-2 * tr[x].a);
  if (tr[x].r > q) tr[x].r = q;
  if (tr[x].l + eps >= tr[x].r - eps) return find_min(tr[x].son[0]);
  if (tr[x].l - eps <= xx && xx <= tr[x].r + eps) return x;
  if (xx <= tr[x].l - eps && tr[x].son[0])
    return find_min(tr[x].son[0]);
  else if (xx >= tr[x].r + eps && tr[x].son[1])
    return find_min(tr[x].son[1]);
  return x;
}
void turn(int x, int t) {
  int y = tr[x].son[t];
  int z = tr[y].son[!t];
  int fa = tr[x].fa;
  if (fa)
    if (tr[fa].son[0] == x)
      tr[fa].son[0] = y;
    else
      tr[fa].son[1] = y;
  tr[x].son[t] = z;
  tr[y].son[!t] = x;
  tr[x].fa = y;
  tr[y].fa = fa;
  if (z) tr[z].fa = x;
}
int uproot(int x) {
  int cnt(0), y(x);
  while (y) tp[++cnt] = y, y = tr[y].fa;
  for (int i = cnt; i >= 2; i--) down(tp[i]);
  for (int i = 2; i <= cnt; i++) dr[i] = (tr[tp[i]].son[1] == tp[i - 1]);
  for (int i = 2; i <= cnt; i += 2) {
    if (i == cnt)
      turn(tp[i], dr[i]);
    else if (dr[i] == dr[i + 1])
      turn(tp[i + 1], dr[i + 1]), turn(tp[i], dr[i]);
    else
      turn(tp[i], dr[i]), turn(tp[i + 1], dr[i + 1]);
  }
  return x;
}
void Work() {
  tot = root = 1;
  tr[1].l = 1, tr[1].r = q;
  tr[1].a = 1;
  tr[1].b = -2 * x[1];
  tr[1].c = x[1] * x[1];
  pair<long double, long double> P;
  int who, l, r;
  for (int i = 2; i <= n; i++) {
    who = find_min(root);
    root = uproot(who);
    P = get_min(root);
    l = tr[root].son[0];
    r = tr[root].son[1];
    if (a != b) {
      if (tr[root].l + eps <= P.first - eps) {
        l = ++tot;
        tr[l] = tr[root];
        tr[l].r = P.first;
        tr[l].son[0] = tr[root].son[0];
        tr[l].son[1] = 0;
        if (tr[root].son[0]) tr[tr[root].son[0]].fa = l;
      }
      trans(l, a);
      if (P.first + eps <= tr[root].r - eps) {
        r = ++tot;
        tr[r] = tr[root];
        tr[r].l = P.first;
        tr[r].son[0] = 0;
        tr[r].son[1] = tr[root].son[1];
        if (tr[root].son[1]) tr[tr[root].son[1]].fa = r;
      }
      trans(r, b);
      tr[root].clear();
      tr[root].c = P.second;
      tr[root].l = P.first + a;
      tr[root].r = P.first + b;
      tr[root].son[0] = l;
      if (l) tr[l].fa = root;
      tr[root].son[1] = r;
      if (r) tr[r].fa = root;
      tr[root].a++;
      tr[root].b -= 2 * x[i];
      tr[root].c += x[i] * x[i];
      tr[root].da++;
      tr[root].db -= 2 * x[i];
      tr[root].dc += x[i] * x[i];
    } else {
      trans(root, a);
      tr[root].a++;
      tr[root].b -= 2 * x[i];
      tr[root].c += x[i] * x[i];
      tr[root].da++;
      tr[root].db -= 2 * x[i];
      tr[root].dc += x[i] * x[i];
    }
    poi[i - 1] = P.first;
  }
  who = find_min(root);
  P = get_min(who);
  ans[n] = poi[n] = P.first;
  for (int i = n - 1; i >= 1; i--)
    if (poi[i] + a - eps <= ans[i + 1] && ans[i + 1] <= poi[i] + b + eps)
      ans[i] = poi[i];
    else if (poi[i] + b + eps <= ans[i + 1])
      ans[i] = ans[i + 1] - b;
    else
      ans[i] = ans[i + 1] - a;
  long double anss(0);
  for (int i = 1; i <= n; i++) anss += (x[i] - ans[i]) * (x[i] - ans[i]);
  for (int i = 1; i <= n; i++)
    if (i != n)
      printf("%.10lf ", (double)ans[i]);
    else
      printf("%.10lf\n", (double)ans[i]);
  printf("%.10lf\n", (double)anss);
}
int main() {
  Init();
  Work();
  return 0;
}
