N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) X = sum(A) / N result = 0 for i in range(N): result += B[i] * abs(X - A[i]) print(X, result)