Minimum Cost


Submit solution

Points: 1
Time limit: 2.0s
Memory limit: 256M

Problem type
Allowed languages
Python

Problem Description

Among n individuals, certain pairs of bank accounts can transfer money to each other.

The transaction fees for transfers between these individuals vary.

Given the percentage of transaction fee deducted from the transfer amount between each pair, determine the minimum amount of money A needs to send so that B receives exactly 100 units after fees.

Input Format
The first line contains two positive integers n, m, representing the total number of people and the number of pairs that can transfer money.

The next m lines each contain three positive integers x, y, z, indicating that a transfer between person x and person y incurs a fee of z% (i.e., z < 100).

The last line contains two positive integers A, B.

The data guarantees that A and B can transfer money directly or indirectly.

Output Format
Output the minimum total amount A needs to send so that B receives 100 units, accurate to 8 decimal places.

Data Range
1 ≤ n ≤ 2000
m ≤ 105

Input Sample:

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

Output Sample:

103.07153164

Comments

There are no comments at the moment.