Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

MB1CH - PP numbers

PP numbers are prime numbers and palindromes in decimal notation at once. Your task is to find n-th PP number in ascending order. Then calculate product of its non-zero digits - let's call it m - and find m-th prime number in ascending order.

Input

In the first line of input there is one positive integer Z (1 ≤ Z ≤ 1000) which states the number of test cases. Following Z lines contain test cases.

Each test case consists of one positive integer n (1 ≤ n ≤ 113) which states the number of PP number to find.

Output

For each test case print in separate line two numbers: n-th PP number and m-th prime number.

Score

Score equals to size (in bytes) of source code of your program. The fewer points you score, the better.

Example

Input:

3
1
5
2

Output:

2 3
11 2
3 5

Added by:Maciej Boniecki
Date:2010-09-18
Time limit:3.150s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi
Resource:2nd Warsaw School of Computer Science Programming Championship

hide comments
2013-12-07 14:18:33 Piotr KÄ…kol
Done.
2013-12-06 03:19:58 Hallvard Norheim Bø
@Piotr: Python 2.7 submissions here need rejudge, some AC solutions are not valid in 2.7.
2012-05-30 12:35:43 Hallvard Norheim Bø
It looks like Python 2.5 has silently been upgraded to 2.7 on spoj.pl. If you rejudge, all Python solutions which pass a float when an int is expected (range(), os.read() etc) will fail. So will all solution close to the time limit, since 2.7 is significantly slower than 2.5.

The best solution would be to restore Python 2.5. If this is not possible, a rejudge of all Python solutions to all challenges are needed :/ This will give NZEC or TLE for a lot of current AC Python solutions.

Last edit: 2012-05-30 12:38:23
2012-05-30 09:14:37 Piotr KÄ…kol
So should I rejudge all Python submission? Are some codes out of date?
2012-05-30 01:27:31 Hallvard Norheim Bø
My old Python 2.5 solution suddenly got NZEC, while the 3.1.2 version works just fine. Is Python 2.5 currently broken?

Update: avoiding float argument to range() and changing "0or 1" to "0 or 1" made it pass. Looks like Python 2.5 really is Python 2.7 :(

Last edit: 2012-05-30 12:42:19
2010-10-18 18:17:18 Maciej Boniecki
I have increased time limit to 20s per test. Rejudge in progress...
2010-10-11 19:59:22 Piotr KÄ…kol
10sec for each test. So even if there are only 2 tests it's possible.

It also can't be checked how much time a submission needed because executing is stopped when time exceed time limit. It can be only check by author of the task changing time limit into for example 100s, then rejudging, and if there's no TLE You would see the real time. If You want You may contact the author if in Your opinion it's necessary.

Last edit: 2010-10-11 20:05:54
2010-10-11 15:00:43 HWK
Is the time limit really 10 secs? If so: Why the 1st rank needed 19,71 secs?
How long needed my submission 4149963?
2010-09-23 04:19:00 :(){ :|: & };:

So now when I wrote something efficient it passes both of your task.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.