import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int type = 0; int nontype = 0; for(int i = 0; i < N; i++) { int t = sc.nextInt(); String s = sc.next(); int len = s.length(); int a = (12 * t) / 1000; a = Math.min(a, len); type += a; nontype += (len - a); } System.out.println(type + " " + nontype); } }