Some columns get wrong estimations for the transition matrix.
Algorithm now works, but I need to increase precision.
Passes Kattis.