import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) data = readlines() a,b = 0,0 for line in data: t,s = line.split() t = int(t) L = len(s) x = t * 12 // 1000 if x > L: x = L a += x b += L - x print(a,b)