#include #pragma region my_template struct Rep { struct I { int i; void operator++() { ++i; } int operator*() const { return i; } bool operator!=(I o) const { return i < *o; } }; const int l_, r_; Rep(int l, int r) : l_(l), r_(r) {} Rep(int n) : Rep(0, n) {} I begin() const { return {l_}; } I end() const { return {r_}; } }; struct Per { struct I { int i; void operator++() { --i; } int operator*() const { return i; } bool operator!=(I o) const { return i > *o; } }; const int l_, r_; Per(int l, int r) : l_(l), r_(r) {} Per(int n) : Per(0, n) {} I begin() const { return {r_ - 1}; } I end() const { return {l_ - 1}; } }; template struct Fix : private F { Fix(F f) : F(f) {} template decltype(auto) operator()(Args&&... args) const { return F::operator()(*this, std::forward(args)...); } }; template T scan() { T res; std::cin >> res; return res; } template bool chmin(T& a, U&& b) { return b < a ? a = std::forward(b), true : false; } template bool chmax(T& a, U&& b) { return a < b ? a = std::forward(b), true : false; } #ifndef LOCAL #define DUMP(...) void(0) template constexpr int OjLocal = OnlineJudge; #endif using namespace std; #define ALL(c) begin(c), end(c) #pragma endregion constexpr auto Inf = numeric_limits::max() / 2; int main() { cin.tie(nullptr)->sync_with_stdio(false); cout << fixed << setprecision(20); int n = scan(); auto go = [&](const vector& a, int64_t x) { vector suff(n + 1); for (int i : Per(n)) suff[i] = a[i] + suff[i + 1]; vector aux(n + 1); for (int i : Rep(n + 1)) aux[i] = x * i + suff[i]; vector res(n); res[0] = -Inf; int64_t mn = aux[0]; for (int i : Rep(1, n)) { res[i] = max(res[i - 1], aux[i] - mn); chmin(mn, aux[i]); } return res; }; int64_t x = scan(); int64_t y = scan(); vector a(n); generate(ALL(a), scan<>); auto l = go(a, x); auto r = go({rbegin(a), rend(a)}, y); auto off = accumulate(ALL(a), int64_t(0)); for (int i : Rep(1, n - 1)) cout << off + l[i] + r[n - i - 1] << '\n'; }