import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arrX = new int[n]; int[] arrY = new int[n]; int[] ans = new int[n]; for (int i = 0; i < n; i++) { arrX[i] = sc.nextInt(); } int min = Integer.MAX_VALUE; for (int i = 0; i < n; i++) { arrY[i] = sc.nextInt(); min = Math.min(min, arrX[i] + arrY[i]); } StringBuilder sb = new StringBuilder(); sb.append(min).append("\n"); sb.append(0).append("\n"); for (int i = 0; i < n; i++) { if (min >= arrX[i]) { ans[i] = arrX[i]; } else { ans[i] = min; } sb.append(ans[i]).append("\n"); } sb.append(min).append("\n"); System.out.print(sb); } }