qwb has talent for solving string problems.He obtains a lowercase string $A$ of length $n \times m$, and he wants to construct another lowercase string $B$ of the same length to make the distance from $A$ to $B$ as small as possible.Because of his laziness, he decides to construct $B$ in an easy way. Firstly, he constructs a string of length $n$, then he repeats it for $m$ times.
For two strings $A$ and $B$ with the same length $L$, their distance is defined as the following:
$$dist(A, B) = \sum_{i = 1}^{L} |A[i] - B[i]|$$
Tell qwb what's the minimum distance he can get.