def main(): import sys input = sys.stdin.readline N = int(input()) X = list(map(int, input().split())) Y = list(map(int, input().split())) D = [x+y for x, y in zip(X, Y)] d = min(D) print(d) print(0) for x, y in zip(X, Y): if x < y: print(x) else: print(max(d - y, 0)) print(d) if __name__ == '__main__': main()