#include using namespace std; using ll = long long; const int mod = 1e9 + 7; const int inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; #define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0) int N, ans = inf; int main() { cin >> N; vector x(N), y(N), point(N + 2); for (int i = 0; i < N; i++) { cin >> x[i]; } for (int i = 0; i < N; i++) { cin >> y[i]; ans = min(ans, x[i] + y[i]); } cout << ans << endl; point[0] = 0, point[N + 1] = ans; for (int i = 1; i < N + 1; i++) { point[i] = min(x[i - 1], ans); } for (int i = 0; i < N + 2; i++) { cout << point[i] << endl; } }