import java.util.Scanner; public class Yukicoder35 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(), T; String S; int ok = 0, ng = 0, type; for (int i = 0; i < N; i++) { T = sc.nextInt(); S = sc.next(); type = (int) (12.0 * (double) T / 1000.0); ok += Math.min(S.length(), type); ng += Math.max(S.length() - type, 0); } System.out.println(ok + " " + ng); } }