// naive #include #include #include #include int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, t, x, y; std::cin >> n >> t >> x >> y; std::vector d(n); for (auto& e : d) std::cin >> e; assert(n <= 20); std::vector cost(n, std::vector(n, 0)); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (d[i] + t < d[j]) { cost[i][j] = x; } else if (d[i] > d[j]) { cost[i][j] = y; } else { cost[i][j] = 0; } } } std::vector dp(1 << n, std::vector(n, 1e18)); for (int i = 0; i < n; ++i) { dp[1 << i][i] = 0; } for (int s = 1; s < 1 << n; ++s) { for (int i = 0; i < n; ++i) if ((s >> i) & 1) { for (int j = 0; j < n; ++j) if (not ((s >> j) & 1)) { int ns = s | 1 << j; dp[ns][j] = std::min(dp[ns][j], dp[s][i] + cost[i][j]); } } } std::vector ans(n + 1, 1e18); for (int s = 1; s < 1 << n; ++s) { int cnt = __builtin_popcount(s); for (int i = 0; i < n; ++i) { ans[cnt] = std::min(ans[cnt], dp[s][i]); } } for (int k = 1; k <= n; ++k) { if (k != 1) std::cout << ' '; std::cout << ans[k]; } std::cout << std::endl; }