using System; using System.Collections.Generic; using System.Linq; using System.Numerics; using static System.Console; using static System.Math; class Program { static void Main() { SetOut(new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false }); var N = FastIO.Int(); var X = new int[N]; var Y = new int[N]; for (int i = 0; i < X.Length; i++) { X[i] = FastIO.Int(); } for (int i = 0; i < Y.Length; i++) { Y[i] = FastIO.Int(); } var m = int.MaxValue; for (int i = 0; i < N; i++) { var d = X[i] + Y[i]; if (m > d) { m = d; } } WriteLine(m); WriteLine(0); for (int i = 0; i < N; i++) { WriteLine(Min(X[i], m)); } WriteLine(m); Out.Flush(); } } public static class FastIO { static System.IO.Stream str = System.Console.OpenStandardInput(); const int size = 1024; static byte[] buffer = new byte[size]; static int ptr = size; static byte Read() { if (ptr == size) { str.Read(buffer, 0, size); ptr = 0; } return buffer[ptr++]; } public static int Int() { var c = Read(); while (c < 0x21) { c = Read(); } var n = false; if (c == '-') { n = true; c = Read(); } var ret = 0; while (c > 0x20) { ret = ret * 10 + c - '0'; c = Read(); } return n ? -ret : ret; } }