#include using namespace std; typedef long long ll; int main(){ int n; cin >> n; ll x[n], y[n]; for(int i = 0; i < n; i++) cin >> x[i]; for(int i = 0; i < n; i++) cin >> y[i]; ll ans[n+2], last = 1e18; ans[0] = 0; for(int i = 0; i < n; i++){ ans[i+1] = min(last-y[i], x[i]); last = min(last, ans[i+1]+y[i]); } ans[n+1] = last; cout << last << endl; for(int i = 0; i < n+2; i++) cout << ans[i] << endl; return 0; }