import sys input = sys.stdin.readline def f(x): return sum(Bi*abs(x-Ai) for Ai, Bi in zip(A, B)) N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) l, r = -10**18, 10**18 while r-l>=5: t1 = (2*l+r)//3 t2 = (l+2*r)//3 if f(t1)>f(t2): l = t1 else: r = t2 v = [(f(x), x) for x in range(l, r+1)] v.sort() print(v[0][1], v[0][0])