Description
Solutions
Minimum Moves to Equal Candy Bars

We have three candies of different taste. A candies of type 1 B candies of type 2 C candies of type 3.

We can perform the following operation any number of times:

Choose any two candies of different taste and turn them into candies of remaining taste. Suppose, we take candy of type 1 and type 2 then they will be converted to type 3.

Our goal is to ensure that all candies have the same taste. If this condition is not achievable, the print -1, else print, 'n', the minimum number of moves required to do so.

Input Format

The first line contains three space-separated integers denoting the Number of candies of type 1(A), Number of Candies of Type 2(B), and Number of candies of type 3(C)

Output Format

Print n which is the minimum number of moves required if the goal is achievable.

If goal is not achievable print -1.

Constraints

1<=A,B,C<=10^8

Example 1:

Input:  A = 1, B = 2, C = 3
Output: -1
Explanation:

It is not possible to make all candies of the same type with the given operation.

Constraints:
    1 <= A, B, C <= 10^8
Thumbnail 0

Testcase

Result
Case 1

input:

output: