# -*- coding:utf-8 -*- import sys if __name__ == "__main__": n = input() a = map(int,raw_input().split()) b = map(int,raw_input().split()) ans = [0 for i in xrange(101)] for i in xrange(n): temp_a, temp_b = a[i],b[i] ans[temp_b] += temp_a if ans[0] >= max(ans[1:]): print "YES" else: print "NO"