using System; using System.Linq; class Program { public void Solve() { int N = int.Parse(Console.ReadLine()); int possible = 0; int success = 0; int successCnt = 0; int missCnt = 0; string[] TS; for (int i = 0; i < N; i++) { TS = Console.ReadLine().Split(' '); possible = 12 * int.Parse(TS[0]) / 1000; if (TS[1].Length < possible) { successCnt += TS[1].Length; } else { if (possible == TS[1].Length) { successCnt += possible; continue; } if (possible < TS[1].Length) { success = possible; } else { success = (possible - TS[1].Length < 0 ? 0 : possible - TS[1].Length); } missCnt += TS[1].Length - possible; successCnt += success; } } Console.WriteLine("{0} {1}", successCnt, missCnt); } static void Main() { var solver = new Program(); solver.Solve(); } }