print((function (o, x)
	for _=1,tonumber(io.stdin:read("*l")) do
		local t = math.floor(12*io.stdin:read("*n")/1000)
		local s = #io.stdin:read("*l")-1
		if t < s then o,x = o+t,x+s-t else o = o+s end
	end
	return string.format("%d %d", o, x)
end)(0, 0))