Stone Groups

Starting from stone counts A, B, C, repeatedly double the smaller of two unequal groups and subtract it from the larger; decide whether all three can become equal.

Medium6BFSMathHash mapSimulationInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Kangho plays a game with stones. The stones sit in three groups holding AA, BB and CC stones. Kangho wants all three groups to hold the same number of stones.

He moves stones one step at a time, and a step works like this.

  1. Pick two groups whose stone counts differ.
  2. Call the smaller count XX and the larger count YY.
  3. Change the smaller group to X+XX+X stones and the larger group to YXY-X stones.

Write a program that prints 1 if repeating the step any number of times can make the three groups hold the same number of stones, and 0 otherwise.

Input

The first line contains AA, BB and CC separated by spaces. (1A,B,C5001 \le A, B, C \le 500)

Output

Print 1 if the three groups can be made to hold the same number of stones, and 0 otherwise.