n = int(input()) ans, miss = 0, 0 for i in range(n): s = input().split() t, l = int(s[0]), len(s[1]) a = min(l, int(t * 12 / 1000)) m = l - a ans = ans + a miss = miss + m print(ans, miss)