n = int(raw_input()) g = 0 b = 0 for _ in range(n): t,s = raw_input().split() c = min(len(s), int(t)*12/1000) g += c b += len(s) - c print g,b