N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) sumAB,sumB2,sumAB2 = 0,0,0 for a,b in zip(A,B): sumAB += a*b sumAB2 += ((a**2)*(b**2)) sumB2 += b**2 X = sumAB/sumB2 FX = 0 for a,b in zip(A,B): FX += b*abs(X-a) print(X,FX)