N = int(input()) lsA = list(map(int,input().split())) lsB = list(map(int,input().split())) def func(arg): a = 0 for i in range(N): a += lsB[i] * abs(arg-lsA[i]) return a def sanbunntan(l,r): while l + 2 < r: c1 = l+(r-l)//3 c2 = r-(r-l)//3 if func(c1)