import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] sa = br.readLine().split(" "); int[] x = new int[n]; for (int i = 0; i < n; i++) { x[i] = Integer.parseInt(sa[i]); } sa = br.readLine().split(" "); int[] y = new int[n]; for (int i = 0; i < n; i++) { y[i] = Integer.parseInt(sa[i]); } br.close(); int ans = 100000000; for (int i = 0; i < n; i++) { ans = Math.min(ans, x[i] + y[i]); } System.out.println(ans); System.out.println(0); for (int i = 0; i < n; i++) { System.out.println(Math.min(x[i], ans)); } System.out.println(ans); } }