# coding=utf-8: n = int(input()) q = list(map(int ,input().split())) p = list(map(int, input().split())) score = list() o_score = 0 k_score = 0 for i, j in zip(q, p): if j <= 1: k_score += i else: score.append(i) if len(score) == 0: o_score = 0 elif len(score) == 1: o_score = score[0] else: o_score = max(set(score)) #print(o_score) #print(k_score) if k_score >= o_score: print("YES") else: print("NO")