#include <bits/stdc++.h>
using namespace std;
const int nMax = 1e5 + 10;
const long long INF = 1e17;
int n, t, e;
long long x[nMax], f[nMax], g[nMax];
int main() {
  scanf("%d%d%d", &n, &e, &t);
  for (int i = 1; i <= n; i++) scanf("%lld", &x[i]);
  long long Min = INF;
  g[0] = -x[1] * 2;
  int p = 0;
  for (int i = 1; i <= n; i++) {
    while (p <= i && (x[i] - x[p + 1]) * 2 >= t) Min = min(Min, g[p++]);
    if (p < i)
      f[i] = f[p] + t;
    else
      f[i] = INF;
    f[i] = min(f[i], Min + x[i] * 2);
    g[i] = f[i] - 2 * x[i + 1];
  }
  for (int i = 1; i <= n; i++) printf("%lld ", f[i]);
  printf("\n");
  printf("%lld\n", f[n] + e);
  return 0;
}
