SALTOS - A los saltos

no tags 

(The English version is following the Spanish version at each section, and is in green text.)

Una secuencia de k números enteros positivos , (k > 1), es saltarina, si los valores absolutos de las diferencias entre elementos sucesivos toman todos los valores posibles desde 1 hasta k-1.

Por ejemplo: la secuencia 51423, es una secuencia saltarina de longitud 5, porque las diferencias entre los elementos sucesivos de la secuencia son: 4,3,2,1

Se desea conocer cuántas secuencias saltarinas hay de longitud L.

En este problema consideramos que las secuencias están formadas únicamente por valores en 1..k.

A sequence of k > 1 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through k-1.

For example, the sequence 51423 is a jolly jumper of length 5, because the differences between consecutive elements are 4,3,2,1

You must to find out how many jolly jumpers are with length = L.

(in this problem we only consider the jolly jumpers built with values only in the 1..k range).

Input

Cada línea de la entrada consta de un entero k, (> 1). Cada línea es un caso diferente para informar. La entrada termina con una línea conteniendo el valor 0, el cual no se procesa.

Each line of the input have an integer k, (> 1). Each line is a different case to process. The input ends with a line that contains the value 0 (this value is the end of data signal and won't be processed).

Output

Por cada línea de la entrada, se debe generar una línea de salida que informa la cantidad de secuencias saltarinas de longitud igual a k.

Your program must to generate one output line for each input line. At each output line you must inform the quantity of jolly jumpers with length equal to k.

Sample

Input
2
3
4
0

Output
2
4
4

hide comments
david_8k: 2012-06-25 13:56:57

Limit on K?


Added by:Coach UTN FRSF
Date:2011-06-06
Time limit:1s-10.91s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:http://uva.onlinejudge.org/external/100/10038.html