N = int(input()) a = list(map(int, input().split(' '))) b = list(map(int, input().split(' '))) s = [0 for _ in range(101)] for x, y in zip(a, b): s[y] += x if s[0] >= max(s[1:]): print('YES') else: print('NO')