using System; using System.Linq; using System.Collections.Generic; using System.IO; class MyClass { public static void Solve() { var N = int.Parse(Console.ReadLine()); var X = Console.ReadLine().Split().Select(int.Parse).ToArray(); var Y = Console.ReadLine().Split().Select(int.Parse).ToArray(); var min = Enumerable.Range(0, N).Select(i => X[i] + Y[i]).Min(); Console.WriteLine(min); var pos = new int[N + 2]; pos[0] = 0; pos[N + 1] = min; for (int i = 0; i < N; i++) { pos[i + 1] = Math.Min(X[i], min); } foreach (var item in pos) { Console.WriteLine(item); } } public static void Main() { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } }