//////////////////////////////////////// ////////////////////
// The safest way to escape from Chicago
// Use the single-Source Shortest Path Method
// The Prev [] in this question is not used. This is used to construct the shortest path.
# Include <iostream>
# Include <iomanip>
Using namespace STD;
# Define min 0.0
Double C [105] [105];
Int Prev [105];
Double Dist [105];
Void build (INT m)
{
Int I, A, B, cost;
For (I = 1; I <= m; I ++)
{
Cin> A> B> cost;
C [a] [B] = C [B] [a] = double (cost)/100;
}
}
Void Dijk (int n, int V)
{
Int I, J, K;
Double tempmax;
For (I = 1; I <= N; I ++) // Initialization
{
Dist [I] = C [v] [I];
If (Dist [I] = min) Prev [I] = 0;
Else Prev [I] = V;
}
C [v] [v] = 1.0;
Dist [vs] = 1.0;
For (I = 1; I <n; I ++)
{
Tempmax = 0.0;
For (k = 1; k <= N; k ++)
If (C [k] [k]! = 1.0 & tempmax <Dist [k]) // find the maximum probability
{
Tempmax = DIST [k];
J = K;
}
C [J] [J] = 1.0;
For (k = 1; k <= N; k ++)
{
If (C [k] [k]! = 1.0 & C [J] [k]! = Min) // modify the DIST Value
If (Dist [k] <Dist [J] * C [J] [k])
{
Dist [k] = DIST [J] * C [J] [k];
Prev [k] = J;
}
}
}
}
Int main ()
{
Int I, j, n, m;
While (CIN> N & n! = 0)
{
Cin> m;
For (I = 0; I <= N; I ++)
For (j = 0; j <= N; j ++)
C [I] [J] = min;
For (I = 0; I <= N; I ++)
C [I] [I] = 0;
Build (m );
Dijk (n, 1 );
Cout <setiosflags (IOs: fixed) <setprecision (6) <Dist [N] * 100 <"percent" <Endl;
}
Return 0;
}