N = input() total_L,total_miss = 0,0 for i in range(0,N): T,S = map(str,raw_input().split()) if len(S)-int(T)*12/1000 < 0: M = 0 else: M = abs(len(S)-int(T)*12/1000) total_L += len(S) total_miss += M print total_L-total_miss,total_miss