package m.shin; import java.util.Scanner; public class Con35 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt() , ok = 0 , batsu = 0; for(int i = 0;i < N;i++){ int T = s.nextInt(); String str = s.next(); T = 12 * T / 1000; if(T >= str.length()){ ok += str.length(); }else{ ok += T; batsu += str.length()-T; } } s.close(); System.out.println(ok + " " + batsu); } }