Problem E
Getting Rid of Coins
When Per was living in New York, he couldn’t use his debit card as often as in Sweden. He had to carry cash all the time and his wallet was getting heavy from all the coins he was carrying around. He was once in a candy store buying a few kilos of candy and he wanted to get rid of as many coins as possible but couldn’t figure out how to do it without getting any change back.
Task
You will be given a price
Input
The first line of input contains an integer
Output
If Per couldn’t pay exactly
Sample Input 1 | Sample Output 1 |
---|---|
13 3 2 1 1 |
5 |
Sample Input 2 | Sample Output 2 |
---|---|
13 2 2 1 1 |
Impossible |