Walmart OA
Anonymous User
340

Problem Statement

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-seprated 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

Sample Testcase 1Sample Testcase 1

Testcase Input

1 2 3

Testcase Output

-1

Can Anyone provide a solution for this question
Thanks

Comments (3)