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 ksScore = Seq.find (fun p -> (fst p) = 0 ) AB |> 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()