A general continued fraction expansion