#C9246. Decimal to RoboLang Conversion

    ID: 53318 Type: Default 1000ms 256MiB

Decimal to RoboLang Conversion

Decimal to RoboLang Conversion

Given two integers N and X, where N represents the base of the RoboLang number system and X is a number in the decimal system, convert X to its equivalent representation in the RoboLang system.

The conversion is performed by repeatedly dividing X by N and collecting the remainders. In mathematical terms, if the RoboLang representation of X is given by $$X = d_kN^k + d_{k-1}N^{k-1} + \cdots + d_0,$$ then the digits \(d_i\) are obtained by computing the remainders when dividing X by N until X becomes zero. Note that if X is zero, the output should be "0".

Your task is to implement the conversion for several test cases.

inputFormat

The first line contains an integer T, the number of test cases. Each of the following T lines contains two space-separated integers: N and X, where:

  • N is the base of the RoboLang number system.
  • X is the number in the decimal system.

outputFormat

For each test case, output a single line that contains the representation of X in the RoboLang number system.

## sample
3
5 23
3 42
4 15
43

1120 33

</p>