n=int(input()) t=list(map(int,input().split())) s=list(map(int,input().split())) a=0 r=-1 for i in range(n): if r