Hide

# Problem ASmallest Calculated Value

Given three integers and the arithmetic operators ($+$, $-$, $*$, $/$), determine the smallest non-negative integer possible without changing the order of the initial integers. Order of the operators is without their normal precedence, just left-to-right. Note: integer division is fine only if the remainder is zero. For example, $9/3$ is okay, $10/3$ is not.

For example:

For $2$, $3$ and $5$, the answer is $0$ ($2+3-5$)
For $9$, $9$ and $9$, the answer is $0$ ($9-9\ /\ 9$)
For $5$, $7$ and $3$, the answer is $1$ ($5-7+3$)

Given three integers, determine the smallest non-negative result that can be computed by placement of the given operators between the numbers. The operators may only be placed between numbers, not in front (they are not unary operators). An operator must be placed between each pair of numbers, numbers cannot be concatenated.

## Input

The single line of input contains three integers, all in the range from $1$ to $1{,}000$.

## Output

Output a single integer, which is the smallest non-negative value possible applying the arithmetic operators.

Sample Input 1 Sample Output 1
2 3 5

0

Sample Input 2 Sample Output 2
9 9 9

0

Sample Input 3 Sample Output 3
5 7 3

1

Hide