open System type Sol() = member this.Solve() = let N = stdin.ReadLine() |> int let S = Array.zeroCreate N for i = 0 to (N-1) do S.[i] <- stdin.ReadLine().Split() |> (fun ss -> (int ss.[0]) , (ss.[1]) ) let f (n,s) = let canType = 12 * n /1000 let toType = Seq.length s if toType <= canType then toType else canType let types = S |> Array.sumBy f let tot = S |> Array.sumBy (fun (n,s) -> Seq.length s ) printfn "%d %d" types (tot - types) let mySol = new Sol() mySol.Solve()