import java.util.Scanner; class N030{ public static void main(String args[]){ Scanner s = new Scanner(System.in); int n = s.nextInt(); int type = 0; int a = 0 , b = 0; for(int i = 0; i < n; i++){ int t = s.nextInt(); String str = s.next(); type = 12 * t / 1000; if(type >= str.length()){ a += str.length(); }else{ a += type; b += str.length() - type; } } System.out.println(a +" "+ b); } }