https://123dok.net/document/6qmem69z-an-efficient-algorithm-to-decide-periodicity-of-b-recognisable-sets-using-msdf-convention.html