import math sum,ok = 0,0 for i in range(int(input())): lst = input().split() sum += len(lst[1]) able = math.floor(int(lst[0])*12/1000) if(able > len(lst[1])): ok += len(lst[1]) else: ok += able print(str(ok)+' '+str(sum-ok))