N = int(input()) X = list(map(int,input().split())) Y = list(map(int,input().split())) m = 10 ** 7 for i in range(N): t = X[i] + Y[i] if t < m: m = t tapi = [0] * (N + 2) tapi[-1] = m for i in range(N): if X[i] <= m and Y[i] <= m: tapi[i + 1] = m - Y[i] elif X[i] > m and Y[i] <= m: tapi[i + 1] = m - Y[i] elif X[i] <= m and Y[i] > m: tapi[i + 1] = X[i] else: tapi[i + 1] = 0 print(m) for t in tapi: print(t)