2359: 【作】【基础】最少的手续费

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:0 解决:0

题目描述

某商业银行规定,两个银行账户之间转账,银行需要收取一定的手续费,且不同的账户之间转账,手续费可能不同。

现给定 lns="http://www.w3.org/1998/Math/MathML"> 个账户中的某些账户之间互相转账的手续费(转账后另一个账户收到的费用 = 转账费用 - 手续费),请问 lns="http://www.w3.org/1998/Math/MathML"> 如果希望通过转账使得 lns="http://www.w3.org/1998/Math/MathML"> 收到 lns="http://www.w3.org/1998/Math/MathML">100 元,那么 lns="http://www.w3.org/1998/Math/MathML"> 需要准备多少钱?

输入

第一行输入两个正整数 lns="http://www.w3.org/1998/Math/MathML">,,分别表示总人数和可以互相转账的人的对数。(lns="http://www.w3.org/1998/Math/MathML">12000)

以下 lns="http://www.w3.org/1998/Math/MathML"> 行每行输入三个正整数 lns="http://www.w3.org/1998/Math/MathML">,,,表示编号为 lns="http://www.w3.org/1998/Math/MathML"> 的人和编号为 lns="http://www.w3.org/1998/Math/MathML"> 的人之间互相转账需要扣除 lns="http://www.w3.org/1998/Math/MathML">% 的手续费 (lns="http://www.w3.org/1998/Math/MathML"><100)。

最后一行输入两个正整数 lns="http://www.w3.org/1998/Math/MathML">,。数据保证 lns="http://www.w3.org/1998/Math/MathML"> 与 lns="http://www.w3.org/1998/Math/MathML"> 之间可以直接或间接地转账。

输出

输出 lns="http://www.w3.org/1998/Math/MathML"> 使得 lns="http://www.w3.org/1998/Math/MathML"> 到账 lns="http://www.w3.org/1998/Math/MathML">100 元最少需要的总费用。精确到小数点后 lns="http://www.w3.org/1998/Math/MathML">8 位。

样例输入 复制

3 3
1 2 1
2 3 2
1 3 3
1 3

样例输出 复制

103.07153164