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.
Problem hidden on 2013-06-09 23:05:42 by Mitch Schwartz

SUM4PRIM - Sum4Primes

English version:

The task is easy! Your program will read a number N, between 1 and 100000, and you will have to return the Nth 4-tupel (A,B,C,D) that verifies:

2<=A<=542, 2<=B<=542, 2<=C<=542, 2<=D<=542

A<B<C<D , 

and E=A+B+C+D and A,B,C,D,E all of them are prime numbers.

If the number N is greater than the order of the last possible 4-tupel, you will have to display the last one.

Input

N, a integer number

Output

the Nth 4-tupel that verifies the previous conditions, and the sum of the four numbers.

Example

Input:
3

Output:
2 3 5 19 29

Versión en español:

La tarea es fácil! Tu programa tiene que leer un número N, entre 1 y 100000, y retornar la N-ésima cuaterna (A,B,C,D) que verifica:

2<=A<=542, 2<=B<=542, 2<=C<=542, 2<=D<=542

A < B < C < D , 

y si E=A+B+C+D, entonces A,B,C,D,E son todos números primos.

Si el número N es mayor que el orden de la última cuaterna posible, el programa tiene que mostrar la última cuaterna. 

Input

N, un número entero en 1..100000

Output

la N-ésima cuaterna que verifica condiciones, y la suma de los números de la cuaterna, separados por un espacio.

Ejemplo

Input:
3

Output:
2 3 5 19 29

Added by:Coach UTN FRSF
Date:2013-05-29
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Backtracking example

hide comments
2013-06-09 21:04:16 Mitch Schwartz
Problem hidden waiting for I/O to be fixed. (Please notify when this is done by leaving a new comment, and the problem can be made visible again.)
2013-06-09 13:14:22 wisfaq
There must be something wrong with the I/O
The following Python prog gives NZEC:
a=int(raw_input())
print a

While
a=raw_input()
print a
returns (understandably) WA

Please check both the input and test files

Last edit: 2013-06-10 11:44:57
2013-06-01 15:00:19 Pablo Zanitti
Note that A<B<C<D, so there are no permutations. The order is lexicographic:

#1: 2 3 5 7 17
#2: 2 3 5 13 23
#3: 2 3 5 19 29
And so forth.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.