#include using namespace std; using ll = long long; const ll inf = 1LL << 60; void solve(){ ll n, a, b, c; cin >> n >> a >> b >> c; vector dist(2 * n, inf); using P = pair; priority_queue, greater

> hq; hq.push({a + b, 3}); dist[3] = a + b; while(!hq.empty()){ ll d = hq.top().first; int pos = hq.top().second; hq.pop(); if(dist[pos] < d) continue; int k = pos >> 1; int t = pos & 1; int npos = (2 * k) % n * 2; if(dist[npos] > d + c){ dist[npos] = d + c; hq.push({d + c, npos}); } npos = (pos + 2) | 1; npos %= (2 * n); ll nd = d + a; if(t == 0) nd += b; if(dist[npos] > nd){ dist[npos] = nd; hq.push({nd, npos}); } } for(int i = 0; i < 2 * n; i += 2){ cout << min(dist[i], dist[i + 1]) << endl;; } } int main(){ solve(); }