#P3403. "Bloody Mary"

    ID: 2413 远端评测题 1000ms 64MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>Northeastern Europe 2001, Western Subregion

"Bloody Mary"

Description

There is a mixture of water, alcohol and tomato juice in three vessels. The volume ratio of components in the first, second and third vessels is equal a1 : a2 : a3, b1 : b2 : b3 and c1 : c2 : c3 correspondingly.

In what volume ratio is it necessary to take liquids from these vessels in order to create a mixture with a component ratio d1 : d2 : d3?

Input

The input consists of four lines. The first line contains values of parameters a1, a2, a3, the others – values of parameters b1, b2, b3; c1, c2, c3 and d1, d2, d3 correspondingly. All numbers are integers from 0 to 1000; each line contains at least one nonzero value. The values on each line are separated by colons (without spaces).

Output

The output contains a single line with the result. The result has the same format as the input data. If it is impossible to create necessary mixture, the output file should contain a single line with word 'impossible'.

1:0:0
0:1:0
0:0:1
3:2:3
3:2:3

Hint

Your outputs must fit in 64bit integers.

Source

Northeastern Europe 2001, Western Subregion