To reach something good it is very useful to have gone astray, and thus acquire experience.
or simply: