N = int(input()) typing_list = list() for i in range(N): typing_list.append(input().split(" ")) success_count = 0 fail_count = 0 typing_num_for_one_msecond = 12 / 1000 for section in typing_list: msecond = int(section[0]) typing_str = section[1] max_typing_len = int(msecond * typing_num_for_one_msecond) if max_typing_len - len(typing_str) >= 0: success_count += len(typing_str) else: success_count += max_typing_len fail_count += len(typing_str) - max_typing_len print("{} {}".format(success_count, fail_count))