import sys sys.setrecursionlimit(10 ** 6) N = int(input()) X = list(map(int, input().split())) A = list(map(int, input().split())) m = {x: a for x, a in zip(X, A)} memo = {} def f(x: int, used) -> int: if x in memo: return memo[x] if x not in m: return x if x in used: return x used.add(x) d = m[x] res = max(f(x-d, used), f(x+d, used)) memo[x] = res return res for x in X: used = set() print(f(x, used) - x)