#include <bits/stdc++.h>
using namespace std;
void Get(int &T) {
  char C;
  bool F = 0;
  for (; C = getchar(), C < '0' || C > '9';)
    if (C == '-') F = 1;
  for (T = C - '0'; C = getchar(), C >= '0' && C <= '9'; T = T * 10 + C - '0')
    ;
  F && (T = -T);
}
int N;
double L, R, P, Q;
double Y[6005];
void Init() {
  Get(N);
  L = 1;
  scanf("%lf%lf%lf", &R, &P, &Q);
  for (int i = 1; i <= N; i++) scanf("%lf", Y + i);
}
struct Func {
  double L, R, A, B, C;
};
vector<Func> F[5];
double MinPos[6005];
void Trans(int X, int Y, double DA, double DB, double DC) {
  double Delta = P;
  int Use = 0;
  F[Y & 1].clear();
  for (typeof(F[X & 1].begin()) i = F[X & 1].begin(); i != F[X & 1].end();
       i++) {
    if (i->R < 1) continue;
    if (i->L > R) continue;
    if (i->A > 0 && Use == 0) {
      double Mid = -(i->B) / (2.0 * i->A);
      if (i->L <= Mid && Mid <= i->R) {
        MinPos[X] = Mid;
        F[Y & 1].push_back((Func){
            i->L + Delta, Mid + Delta, i->A + DA, i->B - 2 * i->A * Delta + DB,
            i->C + Delta * Delta * i->A - i->B * Delta + DC});
        double Min = i->A * (Mid * Mid) + i->B * Mid + i->C;
        F[Y & 1].push_back(
            (Func){Mid + Delta, Mid + Delta + Q - P, DA, DB, Min + DC});
        Delta += Q - P;
        Use++;
        F[Y & 1].push_back((Func){
            Mid + Delta, i->R + Delta, i->A + DA, i->B - 2 * i->A * Delta + DB,
            i->C + Delta * Delta * i->A - i->B * Delta + DC});
        continue;
      } else if (Mid <= i->R) {
        MinPos[X] = i->L;
        double Min = i->A * (i->L * i->L) + i->B * i->L + i->C;
        F[Y & 1].push_back(
            (Func){i->L + Delta, i->L + Delta + Q - P, DA, DB, Min + DC});
        Delta += Q - P;
        Use++;
        F[Y & 1].push_back((Func){
            i->L + Delta, i->R + Delta, i->A + DA, i->B - 2 * i->A * Delta + DB,
            i->C + Delta * Delta * i->A - i->B * Delta + DC});
        continue;
      }
    }
    F[Y & 1].push_back((Func){i->L + Delta, i->R + Delta, i->A + DA,
                              i->B - 2 * i->A * Delta + DB,
                              i->C + Delta * Delta * i->A - i->B * Delta + DC});
  }
  if (Use == 0) MinPos[X] = R;
}
void Debug(int X) {
  for (typeof(F[X & 1].begin()) i = F[X & 1].begin(); i != F[X & 1].end();
       i++) {
    printf("%lf %lf %lf %lf %lf\n", i->L, i->R, i->A, i->B, i->C);
  }
}
double Ans;
double AnsPos[6005];
void Work() {
  F[1].push_back((Func){L, R, 1, -2 * Y[1], Y[1] * Y[1]});
  for (int i = 2; i <= N + 1; i++) {
    Trans(i - 1, i, 1, -2 * Y[i], Y[i] * Y[i]);
  }
  double Pos = MinPos[N];
  if (Pos >= R) Pos = R;
  if (Pos <= L) Pos = L;
  for (int i = N; i >= 1; i--) {
    AnsPos[i] = Pos;
    Ans += (Pos - Y[i]) * (Pos - Y[i]);
    double Le = Pos - Q;
    double Rt = Pos - P;
    if (Le <= MinPos[i - 1] && MinPos[i - 1] <= Rt) {
      Pos = MinPos[i - 1];
    } else if (MinPos[i - 1] <= Le) {
      Pos = Le;
    } else {
      Pos = Rt;
    }
  }
}
void Output() {
  for (int k = 1; k <= N; k++) printf("%lf ", AnsPos[k]);
  puts("");
  printf("%.8lf\n", Ans);
}
int main() {
  Init();
  Work();
  Output();
  return 0;
}
