using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace template { class Program { static void Main(string[] args) { int n = int.Parse(Console.ReadLine()); int finish = 0; int fall = 0; for (int i = 0; i < n; i++) { string[] s = Console.ReadLine().Split(); if (12 * int.Parse(s[0]) / 1000 >= s[1].Length) { finish += s[1].Length; } else { finish += 12 * int.Parse(s[0]) / 1000; fall += s[1].Length - 12 * int.Parse(s[0]) / 1000; } } Console.WriteLine(finish + " " + fall); } } }