#include using namespace std; #define REP(i, m, n) for (int i = (m); i < (int)(n); i++) #define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define reps(i, n) for (int i = 0; i <= (int)(n); i++) #define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--) #define rreps(i, x) for (int i = (int)(x); i >= 0; i--) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back #define fi first #define se second typedef long long ll; typedef pair P; const int inf = INT_MAX; const ll INF = 1LL << 60; const ll mod = 1e9 + 7; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); } int main() { cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; vector X(N), Y(N); rep(i, N) cin >> X[i]; rep(i, N) cin >> Y[i]; ll ans = INF; int x, y; rep(i, N) { if (ans > X[i] + Y[i]) { ans = X[i] + Y[i]; x = X[i]; y = X[i] + Y[i]; } } cout << ans << endl; vector p(N+2); p[0] = 1e9; p[N+1] = ans + 1e9; REPS(i, 1, N) { p[i] = min(X[i-1] + 1e9, ans - Y[i-1] + 1e9); } rep(i, N+2) { cout << p[i] << endl; } return 0; }