Problem C: CS203 Number System

Problem C: CS203 Number System

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1165  Solved: 300
[Submit][Status][Web Board]

Description

Suppose in CS203, the number system only has three values 2,3,6. It holds 2<3<6. Given an integer \(n\), please find the \(n\)-th smallest number in CS203 number system.

Input

The 1st line contains an integer \(T(1 \leq T \leq 10^3)\), the number of test cases.

Next \(T\) lines, each line contains an integer an integer \(n (1 \leq n \leq 10^9)\)

Output

For each test case, print a line, represent the \(n\)-the smallest number in CS203 number system.

Sample Input

2
1
6

Sample Output

2
26

HINT

[Submit][Status]