#B4203. Determine the Animal Mutation

    ID: 11860 Type: Default 1000ms 256MiB

Determine the Animal Mutation

Determine the Animal Mutation

In the city of (CZ), farmer (X) owns a famous farm with (A) chickens and (B) sheep enclosed in a pen. Normally, a chicken has (0) horns and (2) legs, and a sheep has (2) horns and (4) legs. One day, a mysterious cosmic ray hit the farm, and at most one animal mutated. For the mutated animal, at least one of its horn count or leg count is changed (compared to its normal state). Note that after the mutation, an animal cannot have a negative number of horns or legs.

You are given the numbers (A) and (B) (the counts of chickens and sheep, respectively) and also the total number of horns (C) and legs (D) observed in the pen. Your task is to determine the mutation situation.

If no animal mutated (i.e. all animals are normal), output exactly:
No mutation.
If a mutation occurred, there are two possibilities: one mutated chicken or one mutated sheep.

For a mutated chicken (which normally has (0) horns and (2) legs), let its mutated horn and leg counts be (h) and (l) respectively. Then the totals become: [ C = 2B + h, \quad D = 2A + 4B - 2 + l. ] We require that ((h, l) \neq (0, 2)) and (h \ge 0, l \ge 0).

For a mutated sheep (which normally has (2) horns and (4) legs), let its mutated horn and leg counts be (h) and (l). Then the totals become: [ C = 2B - 2 + h, \quad D = 2A + 4B - 4 + l. ] We require that ((h, l) \neq (2, 4)) and (h \ge 0, l \ge 0).

Your program should check the following in order:

  1. If (C = 2B) and (D = 2A + 4B), output No mutation.
  2. Otherwise, if the data can be explained by a mutation of a chicken, output a line in the format: Chicken h l where (h = C - 2B) and (l = D - (2A + 4B - 2)).
  3. Else, if the data can be explained by a mutation of a sheep, output a line in the format: Sheep h l where (h = C - 2B + 2) and (l = D - (2A + 4B - 4)).
  4. If neither possibility is valid, output Impossible.

It is guaranteed that the input will be such that if a mutation is needed, exactly one of the above mutated scenarios will be valid.

inputFormat

The input consists of a single line containing four space-separated integers: (A), (B), (C), (D), where (A) and (B) represent the number of chickens and sheep respectively, and (C) and (D) denote the total number of horns and legs in the pen.

outputFormat

Print a single line. If no animal mutated, print: No mutation. Otherwise, if a mutated chicken explains the counts, print: Chicken h l where (h) and (l) are the mutated chicken's horns and legs. If a mutated sheep explains the counts, print: Sheep h l where (h) and (l) are the mutated sheep's horns and legs. If neither is possible, print: Impossible.

sample

3 2 4 14
No mutation