Being Special

4

2 votes
Easy
Problem

Here , we are considering that a number is a special number if it’s digits only consist 0, 1, 2, 3, 4 or 5.

We are given a number n and we have to find n-th Special Number.

Input:
First line of input contains the number of test cases.

The only line of the test case contains N.

Output:

Print the nth special number.

Constraints:

1<=T<=100

1<=N<=100000

Note : Solution will be available after end of test. Like our page Codeboom for solutions.

Sample Input
2
6
10
Sample Output
5
13
Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?