Optimal carbon storage in even- and uneven-aged forestry