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 sumAll = 0; for (int i = 0; i < N; i++) { int T = sc.nextInt(); int S = sc.next().length(); sumTyped += Math.min((12 * T / 1000), S); sumAll += S; } System.out.println(sumTyped + " " + (sumAll - sumTyped)); } } }