BETA

Difficulty Level: Medium

Submissions: 1649 Accuracy:

21.71%

Special Numbers
       

A number is a special number if it’s digits only consist 0, 1, 2, 3, 4 or 5.

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


Example:

Sample Input:

2
6
10

Sample Output:

5
13

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: jain_rishabh

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.