I'm doing a non-root solution which is VERY inefficient, more than 1000000 cycles on some inputs. I will improve tho.