n = int(input()) ok = 0 ng = 0 for _ in range(n): t, s = input().split() t = int(t) can_type = 12 * t // 1000 l = len(s) cnt = min(can_type, l) ok += cnt ng += l - cnt print(ok, ng)