#line 1 "main.cpp" #include #include #include #include using namespace std; using lint = long long; constexpr lint INF = 1LL << 60; void solve() { int n; lint a, b; cin >> n >> a >> b; vector xs(n); for (auto& x : xs) cin >> x; vector ans(n - 2, 0); { lint mi = 0, sum = 0, ma = -INF; for (int i = 0; i < n - 2; ++i) { sum += a - xs[i]; ma = max(ma, sum - mi); mi = min(mi, sum); ans[i] += ma; } } reverse(xs.begin(), xs.end()); { lint mi = 0, sum = 0, ma = -INF; for (int i = 0; i < n - 2; ++i) { sum += b - xs[i]; ma = max(ma, sum - mi); mi = min(mi, sum); ans[n - 3 - i] += ma; } } lint sum = accumulate(xs.begin(), xs.end(), 0LL); for (auto a : ans) cout << a + sum << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }