Swimming Pool

Given pool dimensions and limited stocks of three tile sizes, find the cheapest whole-tile covering of the floor and four walls, or report impossibility.

Medium6GreedyMathImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

The community center has decided to build a new swimming pool in time for next summer. The pool is a rectangular box of length XX, width YY, and depth ZZ. Its inner surface will be covered with a new kind of high-tech ceramic tile, made in three sizes: 5×55 \times 5, 15×1515 \times 15, and 30×3030 \times 30 (in centimeters). One tile of each size costs 2 cents, 15 cents, and 50 cents, respectively. The tiles are made of a material that cannot be cut, so every tile must be used whole.

The only local store that sells these tiles has a limited stock of each size. Write a program that decides whether the store's stock is enough to tile the whole pool. If it is, the program must also find how many tiles of each size are needed so that the total cost is as small as possible.

The surfaces to tile are the floor (X×YX \times Y) and the four walls (two of X×ZX \times Z and two of Y×ZY \times Z). No gap may remain, and no tile may stick out past the edge of a surface. A tile cannot be bent around a corner, so the floor and each of the four walls are tiled separately.

Input

The input contains several test cases. Each test case has two lines. The first line has three real numbers XX, YY, and ZZ, the length, width, and depth of the pool in meters, given with one digit after the decimal point (0<X,Y50.00 < X, Y \le 50.0 and 0<Z2.00 < Z \le 2.0). The second line has three integers PP, MM, and GG, the number of small, medium, and large tiles the store has in stock (0P,M,G20000000 \le P, M, G \le 2000000).

The end of the input is marked by a line with X=Y=Z=0X = Y = Z = 0. No second line follows it.

Output

For each test case, print one line. If the store's stock can cover the whole pool, print three integers separated by spaces: the numbers of small, medium, and large tiles, in that order, that tile the pool at the lowest possible cost. The combination of tile counts with the lowest cost is always unique. Otherwise, print the word impossivel (without an accent).