#K58482. Smallest Concatenation of Natural Numbers
Smallest Concatenation of Natural Numbers
Smallest Concatenation of Natural Numbers
Given a positive integer \(n\), generate the smallest number created by concatenating all integers from \(1\) to \(n\) in order. Specifically, the number is formed by writing \(1, 2, \ldots, n\) sequentially, and then interpreting the result as an integer.
If \(n < 1\), output \(-1\).
For example, for \(n = 3\), the result is \(123\); for \(n = 10\), the result is \(12345678910\).
inputFormat
The input is read from standard input and consists of multiple test cases. The first line contains a single integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains one integer \(n\).
outputFormat
For each test case, output the smallest concatenation (as defined above) on a new line.
## sample3
3
5
10
123
12345
12345678910
</p>