14683 - Compute number of animals in a cage   

Description

There are rabbits, chickens, and crabs in a cage.

You are given:

  • the total number of animals,

  • the total number of legs, and

  • the total number of tails.

Compute the number of rabbits, chickens, and crabs.

If no valid solution exists (like 9, 48, and 20), output 0.

 

For your information,

  • Crab has no tail but 8 legs
  • Rabbit has 1 tail and 4 legs
  • Chicken has 1 tail and 2 legs

(Hint: Recall the linear equation in variables. 聯立方程式)

Input

Input three non-negative integers: total number of animals, total number of legs, total number of tails.

Output

  • If a solution exists, output three positive integers in order: number of rabbits, chickens, and crabs.

  • Otherwise, output a single 0.

Ensure that the output, including formatting, exactly matches the provided samples.

Sample Input  Download

Sample Output  Download

Tags

11410EE 231002



Discuss