Under construction

Still being built. Things may change

Super Prime

Time limit1sMemory limit1024 MB

Summary
Given n, print the n-th super prime, where a super prime is a prime whose index among all primes is also prime. Up to 1000 queries with n up to 3000.
Level

Easy3 of 10

Topics
Number theory, Sorting
Solved
No attempts yet

Problem

Primes are a central concept for anyone who loves mathematics. A prime is a natural number greater than 11 whose only divisors are 11 and itself. Heujiro thought that some primes are even more special.

Call a prime pp a super prime if the following holds. Let pp be the kk-th smallest of all primes. Then kk is also prime.

Given an integer nn, write a program that prints the nn-th smallest super prime.

Input

The first line contains the number of test cases TT (1≤T≤10001 \le T \le 1000). Each of the next TT lines contains one integer nn (1≤n≤30001 \le n \le 3000).

Output

For each test case, print the nn-th smallest super prime on its own line.

Examples1

  1. Example 1

    Input
    5
    1
    5
    9
    11
    3000
    
    Expected output
    3
    31
    83
    127
    318137