All problems

Solving a System of Linear Equations

hardPythonNumPynp.linalg.solve

A foundry keeps two ready-mixed blends on the shelf and pours a melt by combining them. The table has one row per metal and one column per blend: the entry says how much of that metal one litre of that blend brings with it. An order arrives stating how much of each metal the finished melt must contain in total. The pourer needs the two litre figures — how much of the first blend and how much of the second — that hit the order exactly, with no metal over or short. Every order in this problem can be hit exactly, by exactly one pair of figures.

Task: Print how many litres of each blend the pour needs.

Input

Three lines. The first two are the table, one row per metal, each holding two numbers separated by a space. The third line holds the order: how much of each metal the melt must contain, in the same metal order as the table's rows.

Output

One line holding two figures separated by a single space, each written with exactly two decimal places: litres of the first blend, then litres of the second.

Example:

Input:
2 1
1 3
5 10

Output:
1.00 3.00

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…