MOD = 10 ** 9 + 7 INF = 10 ** 12 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from itertools import permutations def main(): n = int(input()) ans = [0] * (n + 2) M = INF X = list(map(int,input().split())) Y = list(map(int,input().split())) for i in range(n): M = min(M,X[i] + Y[i]) ans[n + 1] = M for i in range(n): x = X[i] y = Y[i] if x < y: ans[i + 1] = min(x,M) else: ans[i + 1] = max(M - y,0) print(M) print(*ans,sep = '\n') if __name__ =='__main__': main()