This page is still under construction.

Parts of this page are still being built. What you see may change.

Bottled-Up Feelings

Interview

Time limit1sMemory limit256 MB

Summary
Find counts of two bottle sizes that sum exactly to the shipment volume with the fewest bottles, or report Impossible.
Level

Easy2 of 10

Topics
Brute force, Math
Solved
No attempts yet

Problem

Peter has a large shipment of fuel oil coming in and nothing good to put it in. All he owns is a set of large bottles that all hold the same volume, plus a set of smaller bottles that also all hold the same volume, smaller than the large ones. Given the volume of the shipment, he wants to store the oil so that

  1. all of the oil is stored,
  2. every bottle he uses is filled to the top, and
  3. the number of bottles used is as small as possible.

Peter already worked out the answer for the bottles he owns, but he keeps wondering what happens when the bottle volumes change. Given the volume of the shipment and the two bottle volumes, work out the answer for him.

Input

The first line contains three positive integers ss, v1v_1 and v2v_2 separated by spaces. ss is the volume of the shipment, with s≤106s \le 10^6. v1v_1 and v2v_2 are the volumes of the large bottle and the small bottle, with v1≤106v_1 \le 10^6, v2≤106v_2 \le 10^6 and v1>v2v_1 > v_2.

Output

Print the number of bottles of volume v1v_1 and the number of bottles of volume v2v_2 that meet all three conditions, separated by a space on one line. If no such split exists, print Impossible. Several splits can store the oil exactly, but only one of them uses the fewest bottles, so the answer is unique.

Examples3

  1. Example 1

    Input
    1000 9 7
    
    Expected output
    108 4
    
  2. Example 2

    Input
    1000 900 7
    
    Expected output
    Impossible
    
  3. Example 3

    Input
    1000 10 7
    
    Expected output
    100 0