import java.util.Scanner; public class yukicoder_35 { public static void main(String[] args) { Scanner stdIn = new Scanner(System.in); int kukan = stdIn.nextInt(); int[] info1 = new int[kukan]; String[] info2 = new String[kukan]; for (int i = 0; i < kukan; i++) { info1[i] = stdIn.nextInt(); info2[i] = stdIn.next(); } int type = 0; int miss = 0; for (int i = 0; i < kukan; i++) { int mojisu = 12 * info1[i] / 1000 ; if (mojisu >= info2[i].length()) { type += info2[i].length(); } else { type += mojisu; miss += info2[i].length() - mojisu; } } System.out.println(type + " " + miss); } }