N = int(input()) types_correct = 0 types_all = 0 for i in range(N): T, S = [i for i in input().split()] time = int(T) length = len(S) types_all += length if length > int((12 * time) / 1000): types_correct += int((12 * time) / 1000) else: types_correct += length print(str(types_correct) + ' ' + str(types_all - types_correct))