import java.util.Scanner; public class No00000035_Main2 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int typeCnt= 0; int nonTypeCnt = 0; int n = Integer.parseInt(scan.nextLine()); for(int i = 0; i < n; i++) { int cnt = (12 * scan.nextInt()) /1000; int strLength = scan.next().length(); if(strLength <= cnt) { typeCnt += strLength; } else { typeCnt += cnt; nonTypeCnt += strLength - cnt; } } System.out.println(typeCnt + " " + nonTypeCnt); scan.close(); } }