Just like every fall, the organizers of the Southwestern Europe Dice Simulation Contest are busy again this year. In this edition you have to simulate a 3-sided die that outputs each of three possible outcomes (which will be denoted by 1, 2 and 3) with a given probability, using three dice in a given set. The simulation is performed this way: you choose one of the given dice at random, roll it, and report its outcome. You are free to choose the probabilities of rolling each of the given dice, as long as each probability is strictly greater than zero. Before distributing the materials to the contestants, the organizers have to verify that it is actually possible to solve this task.
For example, in the first test case of the sample input you have to simulate a die that yields outcome 1, 2 and 3 with probabilities , and . We give you three dice, and in this case the i-th of them always yields outcome i, for each i = 1, 2, 3. Then it is possible to simulate the given die in the following fashion: roll the first die with probability , the second one with probability and the last one with probability .
一个骰子有3个面,3个面(A,B,C面)上分别有3个数字。在本题中,先给出了3个骰子,每个骰子给出3个面的数字。我们保证对于每个骰子,3个面的数字和为10000。之后再给出一个我们希望得到的A,B,C面的结果,然后希望你给3个骰子分配概率, 第一个骰子分配概率 p1,第二个p2,第三个p3,满足
(1) p1 + p2 + p3 = 1
(2) 3个骰子的每个面的期望和等于给出的那个面的期望的和
例如,样例1中
0 0 10000
0 10000 0
10000 0 0
骰子1: A(0), B(0), C(10000)
骰子2: A(0), B(10000), C(0)
骰子3: A(10000), B(0), C(0)
目标: A(3000) B(4000) C(3000)
于是我可以分配 p1 = 3/10, p2 = 4/10, p3 = 3/10
这样
A面期望: p1 * 0 + p2 * 0 + p3 * 10000 = 3000
B面期望: p1 * 0 + p2 * 10000 + p3 * 0 = 4000
C面期望: p1 * 10000 + p2 * 0 + p3 * 0 = 3000
在本题中,保证给出的3个数对的和均为10000。