def f(X): Y=0 for i in range(N): Y+=B[i]*abs(X-A[i]) return Y #================================================ N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) ep=1/(1<<100) L,H=min(A),max(A) while H-L>ep: P=(2*L+H)/3 Q=(L+2*H)/3 if f(P)>=f(Q): L=P else: H=Q C=(L+H)/2 print(C,int(f(C)+0.5))