#K5031. Toy Purchase Possibility
Toy Purchase Possibility
Toy Purchase Possibility
You are given a budget of \(N\) dollars and a requirement to purchase exactly \(M\) toys. There are two types of toys available: Type 1 costs \(A\) dollars and Type 2 costs \(B\) dollars. Your task is to determine whether it is possible to purchase exactly \(M\) toys such that the total cost does not exceed \(N\) dollars.
Formally, determine if there exists an integer \(x\) (where \(0 \le x \le M\)) such that
[ x \times A + (M - x) \times B \le N ]
If such an integer exists, output POSSIBLE
, otherwise output IMPOSSIBLE
.
inputFormat
The input consists of a single line containing four space-separated integers:
N
: the total budget (in dollars).M
: the exact number of toys to purchase.A
: the cost of a Type 1 toy.B
: the cost of a Type 2 toy.
You should read the input from standard input (stdin).
outputFormat
Output a single line to standard output (stdout) containing either POSSIBLE
if it is feasible to purchase exactly \(M\) toys within budget \(N\) dollars, or IMPOSSIBLE
otherwise.
20 4 3 5
POSSIBLE