a=1000/12 b=int(input()) c=[] d=0 e=0 for i in range(b): c.append(input().split()) if int(c[i][0])>=len(c[i][1])*a: d+=len(a) else: d+=c[i][0]//a e+=len(c[i][1])-(c[i][0]//a) print(d,e)