#include <bits/stdc++.h>
const double inf = 1e19;
const double eps = 1e-9;
int ch[600050][2];
double K[600050], B[600050], L[600050], R[600050];
double TK[600050], TB[600050], TX[600050];
int fa[600050];
double x[300050], y[300050];
double q, a, b;
int n, tot, root;
inline int dir(int x) { return x == ch[fa[x]][1]; }
inline void mutate(int x, double tk, double tb, double tx) {
  if (x >= 3) {
    L[x] += tx;
    R[x] += tx;
    B[x] += tb - K[x] * tx;
    K[x] += tk;
  }
  if (x) {
    TX[x] += tx;
    TB[x] += tb - TK[x] * tx;
    TK[x] += tk;
  }
}
inline void release(int x) {
  mutate(ch[x][0], TK[x], TB[x], TX[x]);
  mutate(ch[x][1], TK[x], TB[x], TX[x]);
  TK[x] = 0;
  TB[x] = 0;
  TX[x] = 0;
}
inline void rotate(int x) {
  int y, z, a, b, c;
  y = fa[x];
  z = fa[y];
  b = dir(x);
  a = ch[x][!b];
  if (z) {
    c = dir(y);
    ch[z][c] = x;
  } else
    root = x;
  fa[x] = z;
  fa[y] = x;
  ch[x][!b] = y;
  ch[y][b] = a;
  if (a) fa[a] = y;
}
void splay(int x, int i) {
  int y, z, b, c;
  while (fa[x] != i) {
    y = fa[x];
    z = fa[y];
    if (z == i) {
      release(y);
      release(x);
      rotate(x);
    } else {
      b = dir(x);
      c = dir(y);
      release(z);
      release(y);
      release(x);
      if (b ^ c) {
        rotate(x);
        rotate(x);
      } else {
        rotate(y);
        rotate(x);
      }
    }
  }
  release(x);
}
inline void newnode(int f, int d, double k, double b, double l, double r) {
  tot++;
  ch[tot][0] = 0;
  ch[tot][1] = 0;
  fa[tot] = f;
  if (f)
    ch[f][d] = tot;
  else
    root = tot;
  K[tot] = k;
  B[tot] = b;
  L[tot] = l;
  R[tot] = r;
  TK[tot] = 0;
  TB[tot] = 0;
  TX[tot] = 0;
}
int find_minmax(int i, int d) {
  while (ch[i][d]) {
    release(i);
    i = ch[i][d];
  }
  return i;
}
inline double calc(int i, double x) { return K[i] * x + B[i]; }
int find(int x) {
  int y;
  if (x < 3) return 0;
  release(x);
  if (K[x] * R[x] + B[x] >= 0) {
    y = find(ch[x][0]);
    if (y)
      return y;
    else
      return x;
  }
  return find(ch[x][1]);
}
int main() {
  double ans;
  int i, X, Y;
  scanf("%d%lf%lf%lf", &n, &q, &a, &b);
  for (i = 1; i <= n; i++) scanf("%lf", &x[i]);
  tot = 0;
  newnode(0, 0, 0, -inf, -inf, -inf);
  newnode(1, 1, 0, inf, inf, inf);
  newnode(2, 0, 2, -x[1] * 2, 1, q - (n - 1) * a);
  for (i = 1; i <= n; i++) {
    splay(1, 0);
    splay(2, 1);
    X = ch[2][0];
    Y = find_minmax(X, 1);
    if (K[Y] * R[Y] + B[Y] < 0)
      y[i] = R[Y];
    else {
      Y = find(X);
      if (K[Y] * L[Y] + B[Y] > 0)
        y[i] = L[Y];
      else
        y[i] = -B[Y] / K[Y];
    }
    if (i < n) {
      if (b - a > eps) {
        splay(Y, 0);
        if (y[i] - L[Y] < eps) {
          X = find_minmax(ch[Y][0], 1);
          splay(X, Y);
          newnode(X, 1, 0, 0, y[i] + a, y[i] + b);
        } else if (R[Y] - y[i] < eps) {
          X = find_minmax(ch[Y][1], 0);
          splay(X, Y);
          newnode(X, 0, 0, 0, y[i] + a, y[i] + b);
        } else {
          X = find_minmax(ch[Y][1], 0);
          splay(X, Y);
          newnode(X, 0, K[Y], B[Y], y[i], R[Y]);
          R[Y] = y[i];
          newnode(tot, 0, 0, 0, y[i] + a, y[i] + b);
        }
        splay(tot, 0);
        mutate(ch[tot][0], 0, 0, a);
        mutate(ch[tot][1], 0, 0, b);
      } else
        mutate(root, 0, 0, a);
      mutate(root, 2, -x[i + 1] * 2, 0);
      splay(2, 0);
      Y = find_minmax(ch[2][0], 1);
      while (L[Y] >= q - (n - i - 1) * a) {
        splay(Y, 2);
        X = ch[Y][0];
        ch[2][0] = X;
        fa[X] = 2;
        Y = find_minmax(ch[2][0], 1);
      }
      if (R[Y] > q - (n - i - 1) * a) R[Y] = q - (n - i - 1) * a;
    }
  }
  for (i = n - 1; i >= 1; i--)
    if (y[i + 1] - y[i] < a)
      y[i] = y[i + 1] - a;
    else if (y[i + 1] - y[i] > b)
      y[i] = y[i + 1] - b;
  ans = 0;
  for (i = 1; i <= n; i++) {
    printf("%.7lf ", y[i]);
    ans += (y[i] - x[i]) * (y[i] - x[i]);
  }
  printf("\n%.7lf\n", ans);
  return 0;
}
