from fractions import gcd from datetime import date, timedelta from heapq import* import math from collections import defaultdict, Counter, deque import sys from bisect import * import itertools import copy sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 def main(): n = int(input()) x = list(map(int, input().split())) y = list(map(int, input().split())) ans = float("inf") ansi = -1 for i in range(n): if ans > x[i] + y[i]: ans = x[i] + y[i] ansi = x[i] print(ans) print(0) for i in range(n): if ans>= y[i]: print(ans - y[i]) elif ans >= x[i]: print(x[i]) else: print(ansi) print(ans) if __name__ == '__main__': main()