Using algorithm Viterby