def f(X): result = 0 for i in range(N): result += B[i] * abs(X - A[i]) return result N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ok = 10 ** 6 ng = -(10 ** 6) while ok - ng > 0.0001: m = (ok + ng) / 2 if f(ng) < f(ok): ok = m else: ng = m X = ok print(X, int(f(X) + 0.5))