Product of Two Numbers 2

Given a, b, c, choose positive A, B, C with A*B=C minimizing |A-a|+|B-b|+|C-c|.

Hard8MathNumber theoryBrute forceNo attempts yetTime limit2sMemory limit512 MB

Problem

You are given positive integers aa, bb, and cc. Among all positive integers AA, BB, and CC with A×B=CA \times B = C, find the smallest possible value of Aa+Bb+Cc|A - a| + |B - b| + |C - c|.

x|x| is the absolute value of xx.

Input

The first line contains aa, bb, and cc, separated by spaces. (1a,b,c1091 \le a, b, c \le 10^9)

Output

Print the minimum value of Aa+Bb+Cc|A - a| + |B - b| + |C - c| on the first line. AA, BB, and CC must all be positive integers with A×B=CA \times B = C.