N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) def f(x): tot = 0 for i in range(N): tot += B[i]*abs(x-A[i]) return tot low = -10**6-10 high = 10**6+10 while high-low>1e-5: left = (2*low+high)/3 right = (low+2*high)/3 if f(right)>f(left): high = right else: low = left r = f((low+2*high)/3) l = f((2*low+high)/3) if r>l: print(round((2*low+high)/3),round(l)) else: print(round((low+2*high)/3),round(r))