s-stage Trapezoidal Methods for the Conservation of Hamiltonian Functions of Polynomial Type