#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; void solve() { int n, a, b, c; cin >> n >> a >> b >> c; vector> vp(n, {(ll)1e18, (ll)1e18}); priority_queue, vector>, greater>> pq; pq.push({a + b, 1, 0}); vp[1][0] = a + b; while (!pq.empty()) { auto [cs, nw, flg] = pq.top(); pq.pop(); if (vp[nw][flg] < cs) continue; { auto ncs = cs + c; auto nnw = (nw * 2) % n; if (chmin(vp[nnw][1], ncs)) { pq.push({ncs, nnw, 1}); } } { auto ncs = cs + a + flg * b; auto nnw = (nw + 1) % n; if (chmin(vp[nnw][0], ncs)) { pq.push({ncs, nnw, 0}); } } } rep(i, 0, n) { cout << min(vp[i][0], vp[i][1]) << "\n"; } } int main() { int t = 1; // cin >> t; while (t--) solve(); }