import java.util.Scanner; public class Main_yukicoder35 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int ret = 0; int sn = 0; for (int i = 0; i < n; i++) { int t = sc.nextInt(); int s = sc.next().length(); ret += Math.min(s, 12 * t / 1000); sn += s; } System.out.printf("%d %d\n", ret, sn - ret); sc.close(); } }