TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

As we know, a cuboid (rectangular solid) has three mutually perpendicular edges:
a, b, c. When a, b and c are all integer, the cuboid can be regarded as a×b×c small
cubes gluing together; each of the small cube is 1×1×1.


Now, as in the above figure, there is a laser beam from one vertex to its diagonal
opposite vertex. The width of the laser is negligible, but we care about how many
small cubes the laser passes through.


Given the integer length of the three edges of the cuboid, your job is to work out
how many small cubes the laser passes through (not just contact with its edges or
vertices).

Input Format

Each line of the input is a test case, which contains three integer a, b and c, 0< a,
b, c<106. The last line of input is “0 0 0”.

Output Format

For each case, output the number of small cubes the laser passing through.

Sample Input 1

1 1 3
2 2 3
3 3 3
0 0 0

Sample Output 1

3
4
3

Hints

Problem Source

Migrated from old NTUJ.

2009Hefei

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 200