n=int(input());c,d=0,0 a=[*map(int,input().split())] b=[*map(int,input().split())] for i in range(n): if b[i]==0: c+=a[i] if b[i]==1: d+=a[i] print('YNEOS'[c/sum(a)<.5::2])