atcoder#ARC143A. [ARC143A] Three Integers

[ARC143A] Three Integers

Score : 300300 points

Problem Statement

Three non-negative integers AA, BB, and CC are written on a blackboard. You can perform the following two operations any number of times in any order.

  • Subtract 11 from two of the written integers of your choice.
  • Subtract 11 from all of the written integers.

Your objective is to make all the numbers on the blackboard 00. Determine whether it is achievable. If it is, find the minimum number of times you need to perform an operation to achieve it.

Constraints

  • 0A,B,C10180 \leq A, B, C \leq 10^{18}

Input

Input is given from Standard Input in the following format:

AA BB CC

Output

If the objective is unachievable, print -1. If it is achievable, print the minimum number of times you need to perform an operation to achieve it.

2 2 3
3

Here is one way to make all the numbers 00.

  • Subtract 11 from AA and CC. Now the numbers are 11, 22, 22.
  • Subtract 11 from BB and CC. Now the numbers are 11, 11, 11.
  • Subtract 11 from all the numbers. Now the numbers are 00, 00, 00.
0 0 1
-1
0 0 0
0