def main(): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) scores = [0 for i in range(100)] score = 0 for i, j in enumerate(b): if j == 0: score += a[i] else: scores[i] += a[i] ans = "YES" if score >= max(scores) else "NO" print(ans) if __name__ == "__main__": main()