N=int(input()) X=list(map(int,input().split())) Y=list(map(int,input().split())) T=[0]*(N+2) r=X[0]+Y[0] for i in range(N): if r>X[i]+Y[i]: r=X[i]+Y[i] T[-1]=r for i in range(N): T[i+1]=max(r-Y[i],-X[i]) u=min(T) T=[t-u for t in T] print(r) print(*T,sep="\n")