n = int(input()) w_cnt = 0 w_ttl = 0 for i in range(n): t, w = input().split() t = int(t) w_ttl += len(w) w_inp = int(12*t/1000) if w_inp < len(w): w_cnt += w_inp else: w_cnt += len(w) print(w_cnt, w_ttl-w_cnt)