Dislike of Threes solution codeforces
Polycarp doesn’t like integers that are divisible byor end with the digit in their decimal representation. Integers that meet both conditions are disliked by Polycarp, too.
Polycarp starts to write out the positive (greater than) integers which he likes: . Output the -th element of this sequence (the elements are numbered from ).
The first line contains one integer( ) — the number of test cases. Then test cases follow.
Each test case consists of one line containing one integer( ).
For each test case, output in a separate line one integer— the -th element of the sequence that was written out by Polycarp.
10 1 2 3 4 5 6 7 8 9 1000
1 2 4 5 7 8 10 11 14 1666