import java.io.*; import java.util.*; class Main216 { public static void out (Object o) { System.out.println(o); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int max = 100; int[] score = new int[max + 1]; String[] line1 = br.readLine().split(" "); String[] line2 = br.readLine().split(" "); for (int i = 0; i < n; i++) { int s = Integer.parseInt(line1[i]); int w = Integer.parseInt(line2[i]); score[w] += s; } int maxScore = -1; for (int i = 1; i <= max; i++) { maxScore = Math.max(maxScore , score[i]); } out(score[0] >= maxScore ? "YES" : "NO"); } }