#include <bits/stdc++.h>
template <typename T>
void Scan(T& t) {
  std::cin >> t;
}
template <typename First, typename... Rest>
void Scan(First& first, Rest&... rest) {
  std::cin >> first;
  Scan(rest...);
}
using ll = long long;
using ull = unsigned long long;
constexpr ll INFINT = 1 << 30;
constexpr ll INFINT_LIM = (1LL << 31) - 1;
constexpr ll INFLL = 1LL << 60;
constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);
constexpr double EPS = 1e-9;
constexpr ll MOD = 1000000007;
constexpr double PI = 3.141592653589793238;
ll dp[2003][2003];
ll tt[2003];
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  ll n, e, t;
  Scan(n, e, t);
  ;
  std::vector<ll> x(n);
  for (auto& i : x) std::cin >> i;
  ;
  assert(n <= 2000);
  auto calc = [&](ll i, ll j) {
    return 3 * (x[j] - x[i]) + std::max(t - 2 * (x[j] - x[i]), 0LL);
  };
  for (ll i = 0; i < ll(n); ++i)
    for (ll j = (i); j < (n); ++j) {
      dp[i][j] = calc(i, j);
    }
  std::fill(tt, tt + n + 1, INFLL);
  tt[0] = x[0];
  auto xx = [&](ll i) { return (i == n) ? e : x[i]; };
  for (ll i = 0; i < ll(n + 1); ++i) {
    if (i != 0) {
      tt[i] = (((tt[i]) > (tt[i - 1] + t + xx(i) - x[i - 1]))
                   ? (tt[i - 1] + t + xx(i) - x[i - 1])
                   : (tt[i]));
    }
    for (ll j = 0; j < ll(i); ++j) {
      tt[i] = (((tt[i]) > (tt[j] + dp[j][i - 1] + xx(i) - x[i - 1]))
                   ? (tt[j] + dp[j][i - 1] + xx(i) - x[i - 1])
                   : (tt[i]));
    }
  }
  for (ll i = 0; i < ll(n); ++i) {
    for (ll j = 0; j < ll(n); ++j) {
      std::cout << dp[i][j];
      std::cout << " ";
      ;
    }
    std::cout << "\n";
    ;
  }
  for (ll i = 0; i < ll(n + 1); ++i) {
    std::cout << tt[i];
    std::cout << " ";
    ;
  }
  std::cout << "\n";
  ;
  std::cout << tt[n];
  std::cout << "\n";
  ;
  return 0;
}
