import java.util.Scanner; public class No35 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int words = s.nextInt(); int typed = 0; int missed = 0; for (int i = 0; i < words; i++) { int ms = s.nextInt(); String word = s.next(); int tmp = word.length() - ms * 12 / 1000; if (tmp < 0) { tmp = 0; } typed += word.length() - tmp; missed += tmp; } System.out.println(typed + " " + missed); } }