n = int(input()) m = list(map(int,input().split())) b = list(map(int,input().split())) sco = [0 for i in range(101)] for x,y in zip(m,b): sco[y] += x if sco[0] >= max(sco[1:]): print("YES") else: print("NO")