n = int(input()) x = [int(i) for i in input().split()] y = [int(i) for i in input().split()] ans = 10**8 ctr = -1 for i in range(n): if ans > x[i]+y[i]: ans = x[i]+y[i] ctr = x[i] print(ans) print(0) for i in range(n): if ctr > x[i]: print(x[i]) elif ans - ctr > y[i]: print(ans-y[i]) else: print(ctr) print(ans)