Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 200 点
問題文
1×1×1 のブロックが A×B×C の直方体状に並んでいます。 高橋君は各ブロックを赤色または青色で塗ろうとしています。 このとき、次の条件が成り立つようにします。
- 赤いブロックも青いブロックもそれぞれ 1 個以上ある。
- 赤いブロック全体が 1 つの直方体状になっている。
- 青いブロック全体が 1 つの直方体状になっている。
高橋君は、赤いブロックの個数と青いブロックの個数の差をできるだけ小さくしたいと思っています。 赤いブロックの個数と青いブロックの個数の差の最小値を求めてください。
制約
- 2≤A,B,C≤10^9
入力
入力は以下の形式で標準入力から与えられる。
A B C
出力
赤いブロックの個数と青いブロックの個数の差の最小値を出力せよ。
入力例 1
3 3 3
出力例 1
9
例えば、図のように塗ればよいです。 赤いブロックは 9 個で、青いブロックは 18 個なので、個数の差は 9 です。
入力例 2
2 2 4
出力例 2
0
例えば、図のように塗ればよいです。 赤いブロックは 8 個で、青いブロックも 8 個なので、個数の差は 0 です。
入力例 3
5 3 5
出力例 3
15
例えば、図のように塗ればよいです。 赤いブロックは 45 個で、青いブロックは 30 個なので、個数の差は 15 です。
Score : 200 points
Problem Statement
We have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that:
- There is at least one red block and at least one blue block.
- The union of all red blocks forms a rectangular parallelepiped.
- The union of all blue blocks forms a rectangular parallelepiped.
Snuke wants to minimize the difference between the number of red blocks and the number of blue blocks. Find the minimum possible difference.
Constraints
- 2≤A,B,C≤10^9
Input
The input is given from Standard Input in the following format:
A B C
Output
Print the minimum possible difference between the number of red blocks and the number of blue blocks.
Sample Input 1
3 3 3
Sample Output 1
9
For example, Snuke can paint the blocks as shown in the diagram below. There are 9 red blocks and 18 blue blocks, thus the difference is 9.
Sample Input 2
2 2 4
Sample Output 2
0
For example, Snuke can paint the blocks as shown in the diagram below. There are 8 red blocks and 8 blue blocks, thus the difference is 0.
Sample Input 3
5 3 5
Sample Output 3
15
For example, Snuke can paint the blocks as shown in the diagram below. There are 45 red blocks and 30 blue blocks, thus the difference is 9.