402979: GYM100960 A Prevent a Galactic War!

Memory Limit:0 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Prevent a Galactic War!time limit per test2 secondsmemory limit per test512 mebibytesinputstandard inputoutputstandard output
A long time ago in a galaxy far,
far away....

The Trade Federation is an extremely powerful organization uniting lots of star systems and galaxies under its flag. Among other things there are N branches of industry under the Federation control. Each of them produces a unique kind of product.

During the last year the i-th branch produced xi tons of its product. Some part of the product was sent to other branches' production, while another part was sold to retailers. It's known that during the previous year the j-th branch used cij tons of product produced by the i-th branch. Additionally, the i-th branch sold yi tons of its product to retailers. The Trade Federation controls the process of production very carefully and because of this, there is no shortage nor excess of any product.

The intelligence of the Alliance reported that the Federation is planning to sell tons of product from the i-th branch this year. Since profit from the sold products can help the Federation to build a droid army, the Alliance wants to sabotage the production.

You are young Jedi Obi-Wan Kenobi, and you have just received instructions to compute how much product should i-th branch produce including the product sent to other branches. It's known that the amount of other branches' products needed by the i-th branch is directly proportional to the total amount of product produced by the i-th branch. Write a program that, given the values cij, last year sales yi and planned sales , computes how many tons of product should the i-th branch produce this year.

May the Force be with you!

Input

The first line of input contains integer N, the number of branches (1 ≤ N ≤ 3000).

The next N lines contain N integers each, the i-th of them contains integers ci1, ci2, ..., ciN (1 ≤ cij ≤ 1000); cij means how many tons of product produced by the i-th branch was used by the j-th branch last year.

The next line contains N integers y1, y2, ..., yN, the amount of product of each branch that was sold to retailers last year (107 ≤ yi ≤ 109).

The last line of input contains N integers , the amount of product of each branch that is planned to be sold to retailers this year ().

Output

Print N numbers : the amount of product each branch should produce this year.

The answer is considered correct if , where is the amount of product of i-th branch that could be sold if each branch i produces tons of product.

ExampleInput
3
1 10 1
11 1 1
1 12 1
10000000 20000000 20000000
30000000 20000000 30000000
Output
30000014.50000887 20000035.49997725 30000016.50001112 

加入题单

上一题 下一题 算法标签: