pace = 1000/12 typed = 0 missed = 0 n = int(input()) for i in range(n): l,w = input().split() limit = int(l) if limit/pace >= len(w): typed += len(w) else: typed += int(limit//pace) missed += len(w) - int(limit//pace) print(typed,missed)