3392 - Factory of Painted Wooden Toys

Created by Yonny Mondelo Hernández
Added by ymondelo20 (2015-10-14)
Limits
Total Time: 5000 MS | Test Time: 1000 MS |Memory: 256 MB | Output: 64 MB | Size: 16 KB
Enabled languages
Available in

Description

The International Consortium for Protection of Children’s (ICPC) has a big toy factory. Toys are built from several materials such as iron, aluminum, wood, plastic, glass, etc. Last month, the factory created a new toy that is well-liked by many children. These toys consist of a wooden cube with side length equal to N centimeters. The surface is completely painted with multiple random colors such that the toy has a stylish color combination.




Furthermore, the wooden toys are cut to little cubic pieces of one centimeter on each side (volume of each little cube is 1 cubic centimeter). For instance, a toy of side 3 centimeters long would be cut into exactly 27 little cubes. Your task is to find how many of these little cubes have exactly two painted faces.
El Consorcio Internacional para la Protección de la Infancia (ICPC, por sus siglas en inglés) tiene una gran fábrica de juguetes. Los juguetes están hechos de varios materiales como el hierro, aluminio, madera, plástico, cristales, etc. El mes pasado en la fábrica un juguete nuevo se ha desarrollado el cual realmente gustó a los niños. Estos juguetes consisten en un cubo de madera de N centímetros de lado con la superficie completamente pintada con colores múltiples de manera aleatoria de forma tal que el juguete tiene una combinación de color de moda.



Después de eso, si es posible, los juguetes de madera se cortan en pequeños cubos de un centímetro de lado (el volumen de cada cubo pequeño es de 1 centímetro cúbico); es decir, un juguete de 3 centímetros de lado se corta en exactamente 27 cubos pequeños. Su tarea es encontrar cuántos de estos pequeños cubos tienen exactamente dos caras pintadas.
The International Consortium for Protection of Children’s (ICPC) has a big toy factory. Toys are built from several materials such as iron, aluminum, wood, plastic, glass, etc. Last month, the factory created a new toy that is well-liked by many children. These toys consist of a wooden cube with side length equal to N centimeters. The surface is completely painted with multiple random colors such that the toy has a stylish color combination.




Furthermore, the wooden toys are cut to little cubic pieces of one centimeter on each side (volume of each little cube is 1 cubic centimeter). For instance, a toy of side 3 centimeters long would be cut into exactly 27 little cubes. Your task is to find how many of these little cubes have exactly two painted faces.

Input specification

Input consists of several test cases, but no more than 1000. Each case consists of a line with an integer number N (1 <= N <= 5*10^3) representing the side length in centimeters of the toy. The last line of input is followed by a line containing a zero, which should not be processed.
La entrada consiste de múltiples casos de prueba, no más de 1000. Cada caso consiste en una línea con un número entero N (1 <= N <= 5*10^3) que representa una longitud en centímetros correspondiente con los lados del juguete. Al último caso de prueba le sigue una línea con un cero que no debe ser procesada.
Input consists of several test cases, but no more than 1000. Each case consists of a line with an integer number N (1 <= N <= 5*10^3) representing the side length in centimeters of the toy. The last line of input is followed by a line containing a zero, which should not be processed.

Output specification

For each case, output a line with an integer representing the number of little cubes that have exactly two painted faces cut from the initial cube.
Por cada caso usted debe imprimir una línea con un entero que representa el número de pequeños cubos que tienen exactamente dos caras pintadas después de cortar el cubo inicial.
Input consists of several test cases, but no more than 1000. Each case consists of a line with an integer number N (1 <= N <= 5*10^3) representing the side length in centimeters of the toy. The last line of input is followed by a line containing a zero, which should not be processed.

Sample input

1
3
0

Sample output

0
12

Hint(s)