using System; using System.Linq; class Program { static void Main(string[] args) { // No.35 タイパー高橋 int N = int.Parse(Console.ReadLine()); string ts, S; int T = 0; int ok = 0, miss = 0; for (int i = 1; i <= N; i++) { ts = Console.ReadLine(); T = int.Parse(ts.Split(' ')[0]); S = ts.Split(' ')[1]; ok += S.Length; if (S.Length - (int)((double)T / 1000 * 12) > 0) miss += S.Length - (int)((double)T / 1000 * 12); } Console.WriteLine("{0} {1}", ok - miss, miss); } }