A Quadratic Bolza—Type Problem in a Riemannian Manifold