package me.yukicoder.lv1; import java.util.Scanner; public class No0035 { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { int N = sc.nextInt(); int sumTyped = 0; int sumUnTyped = 0; for (int i = 0; i < N; i++) { int T = sc.nextInt(); int S = sc.next().length(); int cnt = (12 * T / 1000); int mod = S - cnt; sumTyped += Math.min(cnt, S); sumUnTyped += (mod > 0) ? mod : 0; } System.out.println(sumTyped + " " + sumUnTyped); } } }