1: \begin{abstract}
2: Let $n$ be a positive integer and $\mathcal M$ a set of rational
3: $n \times n$-matrices such that $\mathcal M$ generates a
4: finite multiplicative semigroup. We show that any matrix in the
5: semigroup is a product of matrices in $\mathcal M$ whose length is at most
6: $2^{n (2 n + 3)} g(n)^{n+1} \in 2^{O(n^2 \log n)}$, where $g(n)$ is the maximum order
7: of finite groups over rational $n \times n$-matrices.
8: This result implies algorithms with an elementary
9: running time for deciding finiteness of weighted automata
10: over the rationals and for deciding reachability in affine integer
11: vector addition systems with states with the finite monoid property.
12: \end{abstract}