N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) scores = dict([(i, 0) for i in range(101)]) for i in range(N): scores[b[i]] += a[i] K_score = scores[0] max_score = max(list(scores.values())[1:100]) print('YES' if K_score >= max_score else 'NO')