#C10812. Magic Sequence Generation
Magic Sequence Generation
Magic Sequence Generation
You are given two integers \( n \) and \( k \). Consider the Magic Sequence of length \( n \), which is defined as follows:
The first number in the sequence is the integer formed by \( n \) copies of the digit '1' (i.e. \( 11\ldots1 \) with \( n \) digits). Subsequent numbers are generated by adding 1 to the previous number.
Your task is to compute the \( k \)-th number in this sequence.
Note: The magic sequence can be formulated as: \[ \text{Magic}(n,k) = \underbrace{11\ldots1}_{n \text{ ones}} + (k - 1). \]
inputFormat
The first line contains an integer \( T \) representing the number of test cases. Each of the following \( T \) lines contains two space-separated integers \( n \) and \( k \), where \( n \) is the length of the magic sequence number and \( k \) is the position in the sequence.
outputFormat
For each test case, output the \( k \)-th magic sequence number on a new line.
## sample3
1 1
2 2
3 5
1
12
115
</p>