100 atcoder#ABC195B. [ABC195B] Many Oranges

[ABC195B] Many Oranges

Score : 200200 points

Problem Statement

We have many oranges. It is known that every orange weighs between AA and BB grams, inclusive. (An orange can have a non-integer weight.)

We chose some of those oranges, and their total weight was exactly WW kilograms.

Find the minimum and maximum possible numbers of oranges chosen. If no set of oranges can weigh exactly WW kilograms in total, report that fact.

Constraints

  • 1AB10001 \leq A \leq B \leq 1000
  • 1W10001 \leq W \leq 1000
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

AA BB WW

Output

Print the minimum and maximum possible numbers of oranges chosen, in this order, with space in between. If there is no number of oranges that can have the specified total weight, print UNSATISFIABLE instead.

100 200 2
10 20

Here, one range weighs between 100100 and 200200 grams (inclusive).

  • If we choose 1010 200200-gram oranges, their total weight will be exactly 22 kilograms.
  • If we choose 2020 100100-gram oranges, their total weight will be exactly 22 kilograms.

With less than 1010 oranges or more than 2020 oranges, the total weight will never be exactly 22 kilograms, so the minimum and maximum possible numbers of oranges chosen are 1010 and 2020, respectively.

120 150 2
14 16

Here, one range weighs between 120120 and 150150 grams (inclusive).

  • If we choose 1010 140140-gram oranges and 44 150150-gram oranges, for example, their total weight will be exactly 22 kilograms.
  • If we choose 88 120120-gram oranges and 88 130130-gram oranges, for example, their total weight will be exactly 22 kilograms.

With less than 1414 oranges or more than 1616 oranges, the total weight will never be exactly 22 kilograms, so the minimum and maximum possible numbers of oranges chosen are 1414 and 1616, respectively.

300 333 1
UNSATISFIABLE

Here, one range weighs between 300300 and 333333 grams (inclusive).

No set of oranges of this kind can weigh exactly 11 kilograms in total.