import sys input=sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) def main(): import bisect N=I() A=LI() B=LI() def calc(x): temp=0 for i in range(N): temp+=B[i]*abs(x-A[i]) return temp M=10**6+5 left=-M right=M for i in range(500): c1=(2*left+right)//3 c2=(left+2*right)//3 if calc(c1)