Prof. W. Booster, a famous Galactic Institute professor, continues his work on the Ultimate Improbability Theory. Currently, it consists of *n* hypotheses. Some of them are based on other hypotheses of the Theory. Like any other theory which deals with Improbability effects, Booster's one is extremely complicated so there's nothing surprising about the fact that cause-and-effect relations between the hypotheses can form cycles.

After several desperate, but still rather unsuccessful attempts to explain results of the very last experiment by means of the Theory, the professor began to suspect that something must be definitely wrong with some of the hypotheses.

To search for mistakes in the Improbability Theory Prof. Booster constructed a special computer which allows to determine in *t*_{i} seconds whether *i*-th hypothesis is *admissible*. The computer can check hypotheses in any order but no more than one at a time. The professor also managed to compute the probabilities *p*_{i} of the *i*-th hypothesis being admissible. It is known that the admissibility of any hypothesis doesn't depend in any way on the admissibility of any other hypothesis.

The professor considers a hyphothesis *correct* if it's admissible and all of the hypotheses it is (directly or indirectly) based upon are admissible too. Now Prof. Booster is going to positively identify which of hypotheses are correct and which are not. Help him to calculate the expected time it will take if the checking process would be organized in an optimal way.

### Input

The first line contains the number of hypotheses in the Improbability Theory *n* (1 ≤ *n* ≤ 500). Next *n* lines describe hypotheses. The *i*-th of these lines starts with three numbers *t*_{i} (1 ≤ *t*_{i} ≤ 1000), *p*_{i} (0.0001 ≤ *p*_{i} ≤ 0.9999), and *k*_{i} (0 ≤ *k*_{i} < *n*), followed by *k*_{i} different numbers of hypotheses the *i*-th hypothesis is directly based upon. No hypothesis is directly based upon itself. Hypotheses are numbered with integers from 1 to *n*. All *t*_{i} are integers.

### Output

Output the expected time required to determine the correctness of every hypothesis. The answer must be accurate up to 10^{−3}.

### Samples

input | output |
---|

4
5 0.3 1 2
6 0.99 0
2 0.2 1 4
2 0.2 0 | 13.350 |

3
1 0.5 1 2
2 0.5 1 3
3 0.5 1 1 | 2.750 |

**Problem Author: **Damir Akhmetzyanov

**Problem Source: **Ufa SATU Contest. Petrozavodsk Summer Session, August 2009