#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; typedef bitset<16> BS; const ll MOD = 1E+09 + 7; const ll INF = 1E18; const int MAX_N = 2E+05; int N; int X[MAX_N + 2], Y[MAX_N + 2], Z[MAX_N + 2]; int ans[MAX_N + 2]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> N; for (int i = 1; i <= N; i++) { cin >> X[i]; } for (int i = 1; i <= N; i++) { cin >> Y[i]; } for (int i = 1; i <= N; i++) { Z[i] = X[i] + Y[i]; } int d = *min_element(Z + 1, Z + N + 1); ans[0] = 0, ans[N + 1] = d; for (int i = 1; i <= N; i++) { if (X[i] >= d) { ans[i] = d; } else { ans[i] = X[i]; } } /* for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n"; } } */ cout << d << "\n"; for (int i = 0; i <= N + 1; i++) { cout << ans[i] << "\n"; } return 0; }