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