#include <bits/stdc++.h>
using namespace std;
const int N = 6006;
const double inf = 2e9;
int n, q, a, b, tot, k;
double first[N], tmp, ans[N];
pair<double, double> c[N * 2];
int main() {
  scanf("%d%d%d%d", &n, &q, &a, &b);
  for (int i = 1; i <= n; i++) {
    scanf("%lf", &first[i]);
    if (i == 1) {
      c[tot++] = pair<double, double>(1, 2 * (1 - first[i]));
      c[tot++] = pair<double, double>(inf, 2 * (inf - first[i]));
      k = 0;
    } else {
      for (int j = tot - 1; j > k; j--) c[j + 2] = c[j];
      tot += 2;
      c[k + 1] = pair<double, double>(tmp, 0);
      c[k + 2] = pair<double, double>(tmp, 0);
      k++;
      for (int j = 0; j <= k; j++) c[j].first += a;
      for (int j = k + 1; j < tot; j++) c[j].first += b;
      for (int j = 0; j < tot; j++) c[j].second += 2 * (c[j].first - first[i]);
    }
    if (c[0].second >= 0) {
      k = -1;
      tmp = c[0].first;
    } else {
      for (k = 0; k < tot; k++)
        if (c[k].second <= 0 && c[k + 1].second > 0) break;
      tmp = c[k].first - c[k].second / (c[k + 1].second - c[k].second) *
                             (c[k + 1].first - c[k].first);
    }
    ans[i] = tmp;
  }
  ans[n] = min(ans[n], (double)q);
  double sum = 0;
  for (int i = n; i >= 2; i--)
    ans[i - 1] = min(max(ans[i - 1], ans[i] - b), ans[i] - a);
  for (int i = 1; i <= n; i++)
    printf("%.9lf ", ans[i]), sum += (ans[i] - first[i]) * (ans[i] - first[i]);
  printf("\n%.9lf\n", sum);
}
