open System open System.Collections.Generic let read() = Console.ReadLine() let readInt() = read() |> int let make() = let num = readInt() let arr = Array.init num (fun _ -> read()) num,arr let cnt keys arr = let t = new Dictionary() for k in keys do t.[k] <- 0 for v in arr do t.[v] <- t.[v] + 1 t let scores = let t = new Dictionary() for i in 1..5 do let tt = Console.ReadLine().Split() t.[tt.[0]] <- tt.[1] |> int t [] let main _ = let n1,A = make() let n2,B = make() let n3,C = make() let cnt0 = cnt scores.Keys let cntA = cnt0 A let cntB = cnt0 B let cntC = cnt0 C let occurrences = let t = new Dictionary() for k in scores.Keys do t.[k] <- 0 t let mutable sum = 0 for k in scores.Keys do let occur = cntA.[k] * cntB.[k] * cntC.[k] * 5 if occur <> 0 then sum <- sum + occur * scores.[k] occurrences.[k] <- occurrences.[k] + occur float sum / float (n1 * n2 * n3) |> printfn "%f" scores.Keys |> seq |> Seq.iter(fun k -> printfn "%i" occurrences.[k]) 0