let parseInput = function | "NONE" -> [||] | x -> x.Split(',') |> Array.map (fun x -> x.[0]) let R() = stdin.ReadLine() |> parseInput let solve r g b = let f = Array.length >> (-) 16 let rN = r |> f let gN = g |> f let bN = b |> f rN * rN * gN * gN * bN * bN let r = R() let g = R() let b = R() solve r g b |> printfn "%i"