import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int []T = new int[N]; String []S = new String[N]; for(int i = 0; i < N; i++) { T[i] = scan.nextInt(); S[i] = scan.next(); } scan.close(); int ans1 = 0; int ans2 = 0; for(int i = 0; i < N; i++) { int k = S[i].length() - T[i] * 12 / 1000; if(k <=0) { ans1 += S[i].length(); }else { ans1 += T[i] * 12 / 1000; ans2 += k; } } System.out.println(ans1 + " " + ans2); } }