ans1, ans2 = 0, 0 for _ in range(int(input())): t, s = input().split() t = int(t) s = len(s) succ = min(s, (t * 12 + 999) // 1000) failed = s - succ ans1 += succ ans2 += failed print(ans1, ans2)