All Tracks Math Number Theory Primality Tests Problem

Another Prime Problem
/
No tags
Problem
Editorial
Analytics

Given a number N find the smallest number K such that it satisfies all the 3 rules -
i) K >= N .
ii) K is a prime number
iii) K ≡ 1 (mod 11 )

The expression a ≡ b (mod n), pronounced “a is congruent to b modulo n,” means that a − b is a multiple of n


Note :Fast input Output Recommended

Input

First line of input comprises an integer T- the number of test cases.
T lines follow.
Each of those T lines has an integer N.

Output
Print T lines, with each line containing output value .

Constraints
1<=T<=106
0<= N<=106

Setter - Abhinav Vinci

SAMPLE INPUT
3
3
32
1213
SAMPLE OUTPUT
23
67
1277
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

Initializing Code Editor...
Notifications
View All Notifications

?