backward algorithm for a continued fraction