import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); if (N < 1||N > 1000) System.exit(1); int type = 0; int miss = 0; int T, S; for (int i = 0; i < N; i++) { T = scan.nextInt(); S = scan.next().length(); if (T < 1||T > 30000||S < 1||S > 100) System.exit(1); int tmptype = 12*T / 1000; if (S < tmptype) type += S; else { type += tmptype; miss += S - tmptype; } } System.out.println(type+" "+miss); } }