open System type Sol() = member this.Solve() = let N = stdin.ReadLine() |> int let A = stdin.ReadLine().Split() |> Array.map int let B = stdin.ReadLine().Split() |> Array.map int let AB = Array.zip B A |> Seq.groupBy fst |>Seq.map (fun (x,ss) -> (x,Seq.sumBy snd ss) ) let res = Seq.tryFind (fun p -> (fst p) = 0 ) AB let ksScore = if Option.isNone res then 0 else (Option.get res |> snd) let elseScore = Seq.filter (fun p -> (fst p) <> 0 ) AB |> Seq.map snd |> Seq.max (if ksScore < elseScore then "NO" else "YES") |> printfn "%s" let mySol = new Sol() mySol.Solve()