Farmer John has decided to bring water to his N (1
Farmer John has decided to bring water to his N (1 <= N <= 300) pastures which are conveniently numbered 1..N. He may bring water to a pasture either by building a well in that pasture or connecting the pasture via a pipe to another pasture which already has water. Digging a well in pasture i costs Wi (1 <= Wi <= 100,000). Connecting pastures i and j with a pipe costs P_{ij} P ij (1 <= P_{ij} P ij <= 100,000; P_{ij} P ij = P_{ji} P ji ; P_{ii} P ii =0). Determine the minimum amount Farmer John will have to pay to water all of his pastures. POINTS: 400