import std.stdio, std.conv, std.string, std.range, std.math, std.bigint, std.algorithm, core.bitop; void main() { auto N = readln.strip.to!int; auto a = readln.split.to!(int[]); auto b = readln.split.to!(int[]); int[int] score = [0: 0]; iota(N).array.each!(i => score[b[i]] += a[i]); (score.values.reduce!max <= score[0] ? "YES" : "NO").writeln; }