Submit: 8 Solved: 4

[Submit] [Status] [Web Board] [Creator:]

Arithmancy is Draco Malfoy's favorite subject, but what spoils it for him is that Hermione Granger is in his class, and she is better than him at it. Prime numbers are of mystical importance in Arithmancy, and Lucky Numbers even more so. Lucky Numbers are those positive integers that have at least three distinct prime factors; 30 and 42 are the first two. Malfoy's teacher has given them a positive integer n, and has asked them to find the nth lucky number. Malfoy would like to beat Hermione at this exercise, so although he is an evil git, please help him, just this once. After all, the know-it-all Hermione does need a lesson.

The first line contains the number of test cases T. Each of the next T lines contains one integer n.

Output T lines, containing the corresponding lucky number for that test case.

```
2
1
2
```

```
30
42
```

**Constraints:**

1 <= T <= 20

1 <= n <= 1000