#K81982. Reach the Target

    ID: 35874 Type: Default 1000ms 256MiB

Reach the Target

Reach the Target

You are given two positive integers x and y along with a target integer z. Your task is to determine whether it is possible to obtain z by either:

  • Concatenating x and y in one of the two orders (xy or yx), or
  • Repeatedly performing addition operations with either x or y on intermediate numbers.

During the addition process, you start from the pair (x, y) and in each step, you may add either x or y to one of the numbers in the current pair. If at any point the sum of the two numbers equals z, the answer is Possible. Otherwise, if no sequence of operations can achieve z (and intermediate results are constrained to be at most 100,000), output Impossible.

inputFormat

The input consists of a single line containing three integers x, y, and z separated by spaces.

outputFormat

Output a single string: Possible if the target can be reached using the operations described, or Impossible otherwise.

## sample
2 3 23
Possible