print1915. Sawing the Beam

printSawing the Beam

Ограничения: время – 1s/2s, память – 32MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (0)

Bob wants to saw the beam (rectangular parallelepiped with integer length, width and height) to get unit cubes. He wants to minimize the number of cuttings, putting several parts of the beam together so, that one cutting may separate them simultaneously.
Write the program, which for given length, width and height calculates the minimal amount of cuttings needed for partition of the beam into unit cubes.
Input
First line of the input file contains 3 integers (from 1 to 1000), separated by the space; they represent length, width and height of the beam.
Output
On the first line of the output file write minimal amount of cuttings.

Sample Input #1

3 3 3

Sample Output #1

6

Sample Input #2

4 4 4

Sample Output #2

6
loading