MAX_N = 100
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
score = [0 for _ in range(MAX_N+1)]
for i in range(n):
    score[b[i]] += a[i]
if score[0] >= max(score):
    print('YES')
else:
    print('NO')