#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000 + 10;
const int MAXM = 100 + 10;
const int MOD = 51061;
const int INF = 1000000001;
const double EPS = 1e-10;
int q;
struct Node {
  double x, y;
  double px, pk, pb;
  Node *ch[2], *p;
  Node() { px = pk = pb = 0; }
  void add(double v) {
    x += v;
    px += v;
    pb -= pk * v;
  }
  void add(double k, double b) {
    pk += k;
    pb += b;
    y += k * x + b;
  }
  void down() {
    if (fabs(px) > EPS) {
      ch[0]->add(px);
      ch[1]->add(px);
      px = 0;
    }
    if (fabs(pk) > EPS || fabs(pb) > EPS) {
      ch[0]->add(pk, pb);
      ch[1]->add(pk, pb);
      pk = pb = 0;
    }
  }
  void link(Node *x, bool dir) {
    ch[dir] = x;
    x->p = this;
  }
  bool dir() const { return p->ch[1] == this; }
} * nil, *root, node[MAXN];
void rotate(Node *now, bool dir) {
  Node *tmp = now->ch[dir];
  if (now == root)
    root = tmp;
  else
    now->p->link(tmp, now->dir());
  now->link(tmp->ch[dir ^ 1], dir);
  tmp->link(now, dir ^ 1);
}
void splay(Node *now) {
  static stack<Node *> sta;
  Node *cur = now;
  sta.push(cur);
  for (; cur != root; cur = cur->p) sta.push(cur->p);
  while (!sta.empty()) {
    sta.top()->down();
    sta.pop();
  }
  while (now != root) {
    Node *fa = now->p;
    bool d1 = now->dir();
    if (fa == root) {
      rotate(fa, d1);
      return;
    }
    Node *pa = fa->p;
    bool d2 = fa->dir();
    if (d1 ^ d2) {
      rotate(fa, d1);
      rotate(pa, d2);
    } else {
      rotate(pa, d2);
      rotate(fa, d1);
    }
  }
}
int tnode;
Node *newNode() {
  node[tnode].ch[0] = nil;
  node[tnode].ch[1] = nil;
  return &node[tnode++];
}
void init() { root = nil = newNode(); }
void insert(Node *&now, double x, double y, Node *fa = nil) {
  if (now == nil) {
    now = newNode();
    now->x = x;
    now->y = y;
    now->p = fa;
    splay(now);
    return;
  }
  now->down();
  insert(now->ch[x > now->x], x, y, now);
}
Node *getZero(Node *now) {
  if (now == nil) return nil;
  now->down();
  if (now->y > 0 || now->x > q) {
    Node *tmp = getZero(now->ch[0]);
    if (tmp != nil) return tmp;
    return now;
  } else {
    Node *tmp = getZero(now->ch[1]);
    if (tmp != nil && tmp->y < 0) return tmp;
    return now;
  }
}
Node *getMax(Node *now) {
  if (now == nil) return nil;
  while (now->ch[1] != nil) {
    now->down();
    now = now->ch[1];
  }
  return now;
}
Node *getMin(Node *now) {
  if (now == nil) return nil;
  while (now->ch[0] != nil) {
    now->down();
    now = now->ch[0];
  }
  return now;
}
double x[MAXN], y[MAXN];
double f(double k, double b, double x) { return k * x + b; }
double getZero(double x1, double y1, double x2, double y2) {
  if (fabs(y1 - y2) < EPS) return x1;
  return (x2 * y1 - x1 * y2) / (y1 - y2);
}
void print(Node *now) {
  if (now == nil) return;
  now->down();
  print(now->ch[0]);
  cout << "(" << now->x << "," << now->y << ")" << endl;
  print(now->ch[1]);
}
double getZero() {
  Node *cur = getZero(root);
  splay(cur);
  if (cur->y > 0) return cur->x;
  Node *R = getMin(cur->ch[1]);
  if (R->y < 0) return q;
  return min((double)q, getZero(cur->x, cur->y, R->x, R->y));
}
int main() {
  ios::sync_with_stdio(false);
  int n, a, b;
  cin >> n >> q >> a >> b;
  for (int i = 1; i <= n; i++) cin >> x[i];
  init();
  insert(root, q, f(2, -2 * x[1], q));
  insert(root, 1, f(2, -2 * x[1], 1));
  y[1] = x[1];
  for (int i = 2; i <= n; i++) {
    double X = y[i - 1];
    if (root->y <= 0) {
      root->ch[1]->add(b);
      root->x += a;
      root->ch[0]->add(a);
    } else
      root->add(b);
    insert(root, X + a, 0);
    insert(root, X + b, 0);
    root->add(2, -2 * x[i]);
    y[i] = getZero();
  }
  for (int i = n - 1; i >= 1; i--) {
    if (y[i] + b < y[i + 1])
      y[i] = y[i + 1] - b;
    else if (y[i] + a > y[i + 1])
      y[i] = y[i + 1] - a;
  }
  cout.setf(ios::fixed);
  cout.precision(10);
  for (int i = 1; i <= n; i++) cout << y[i] << " ";
  cout << endl;
  double ans = 0;
  for (int i = 1; i <= n; i++) ans += ((y[i] - x[i]) * (y[i] - x[i]));
  cout << ans << endl;
  return 0;
}
