please tell me logic behind this question
question-
You are provided a sequence of number. All numbers of that sequence is in increasing order (including 1) and whose only prime factors are 2, 3 or 5 (except 1). You need to find the nth number of that sequence.
Input Format
First line contains integer t which is number of test case. For each test case, it contains an integer n.
Constraints
1<=t<=100 1<=n<=10000
Output Format
Print nth number of that sequence.
Sample Input
2
7
10
Sample Output
8
12