A general formula for the Magnus expansion in terms of iterated integrals of right-nested commutators