There is a direct bidirectional road between every pair of distinct towns in the country. Terrorists want to blow up enough of these roads that there are at least two towns that are no longer connected to each other by any direct or indirect paths.
You will be given a String roads. The j-th character of the i-th element of roads is a digit representing the cost of blowing up the road from the i-th town to the j-th town. Return the minimal total cost required for the terrorists to achieve their goal.
|-||roads will contain between 2 and 50 elements, inclusive.|
|-||Each element of roads will contain the same number of characters as the number of elements in roads.|
|-||Each element of roads will consist of digits ('0' - '9') only.|
|-||The i-th character of the j-th element of roads will be equal to the j-th character of the i-th element for all pairs of i and j.|
|-||The i-th character of the i-th element of roads will be '0' for all i.|