import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class No35 { public static void main(String[] args) throws IOException { //タイパー高橋 String[] text = readStr(); int N = Integer.parseInt(text[0]) , ok = 0 , out = 0; for(int i = 0;i < N;i++) { int T = Integer.parseInt(text[i+1].split(" ")[0]) , t = (int)((T * 12) / 1000); String S = text[i+1].split(" ")[1]; ok += Math.min(S.length(), t); out += Math.max(S.length() - t , 0); } System.out.println(ok + " " + out); } public static String[] readStr() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList list = new ArrayList<>(); do { list.add(br.readLine()); }while(br.ready()); br.close(); String[] text = new String[list.size()]; list.toArray(text); return text; } }