import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int win = 0; int lose = 0; for (int i = 0; i < n; i++) { int mili = sc.nextInt(); int length = sc.next().length(); int max = 12 * mili / 1000; int count = Math.min(length, max); win += count; lose += length - count; } System.out.println(win + " " + lose); } }