Boundary terms and on-shell action in Ricci-based gravity theories: The Hamiltonian formulation | Publicación