import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(reader.readLine()); String[] line; int typebleCounter = 0; int notTypebleCounter = 0; for (int i = 0; i < N; i++) { line = reader.readLine().split(" "); int T = Integer.parseInt(line[0]); String S = line[1]; int typableLength = (12 * T)/1000; if(S.length() <= typableLength) { typebleCounter+=S.length(); } else { typebleCounter+=typableLength; notTypebleCounter += (S.length()-typableLength); } } System.out.println(typebleCounter + " " + notTypebleCounter); } }