At the Department for Bills and Coins, an extension of today's monetary system has newly been proposed, in order to make it fit the new economy better. A number of new so called ecoins will be produced, which, in addition to having a value in the normal sense of today, also have an InfoTechnological value. The goal of this reform is, of course, to make justice to the economy of numerous dotcom companies which, despite the fact that they are low on money surely have a lot of IT inside. All money of the old kind will keep its conventional value and get zero InfoTechnological value.
To successfully make value comparisions in the new system, something called the emodulus is introduced. This is calculated as SQRT(X*X+Y*Y), where X and Y hold the sums of the conventional and InfoTechnological values respectively. For instance, money with a conventional value of $3 altogether and an InfoTechnological value of $4 will get an emodulus of $5. Bear in mind that you have to calculate the sums of the conventional and InfoTechnological values separately before you calculate the emodulus of the money.
To simplify the move to ecurrency, you are assigned to write a program that, given the emodulus that shall be reached and a list of the different types of ecoins that are available, calculates the smallest amount of ecoins that are needed to exactly match the emodulus. There is no limit on how many ecoins of each type that may be used to match the given emodulus.
Sample Input32 5 0 2 2 0 3 20
3 5

Sample Outputnot possible10 2

The illustration examplifies adding 8 coins of conventional value 2 and InfoTechnological value 1, and 2 coins with pure InfoTechnological value 2. The emodulus is of course 20 as SQRT((8*2+2*0)^2+(8*1+2*2)^2)=SQRT(16^2+12^2)=20