#include #include #include #include #include #include #include using namespace std; const int infinity = 1 << 29; int table[40][40]; int m; int n; int connect[40][40]; int t[10]; double high; double Solve(int src, int dest) { bool check[40]; memset(check, 0, sizeof(check)); high = 1e+30; multimap > up; up.insert(make_pair(0.0, make_pair(src, 0))); int count = 0; while(!up.empty()) { count++; double cost = up.begin()->first; int p = up.begin()->second.first; int d = up.begin()->second.second; up.erase(up.begin()); //cout << p << ' ' << dest << ' ' << d << ' ' << cost << endl; if(p == dest){ high = cost; //cout << "count = " << count << endl; return high; } if(d >= n){ continue; } if(check[p]) continue; check[p] = true; for(int i = 0; i < m; ++i) { if(table[p][i] == infinity) continue; up.insert(make_pair(cost+((double)table[p][i])/t[d], make_pair(i, d+1))); } } //cout << "Count = " << count << endl; return high; } int main(){ while(true){ int p, a, b; cin >> n >> m >> p >> a >> b; if(n == 0 && m == 0 and p == 0 and a == 0 and b == 0){ break; } a--; b--; bool checked[m]; for(int i = 0; i < m; i++){ for(int j = 0; j < m; j++){ table[i][j] = infinity; } checked[i] = false; } for(int i = 0; i < n; i++){ cin >> t[i]; } sort(t, t + n, greater()); for(int i = 0; i < p; i++){ int x, y, z; cin >> x >> y >> z; x--; y--; table[x][y] = z; table[y][x] = z; } for(int i = 0; i < m; ++i) for(int j = 0; j < m; ++j) { connect[i][j] = (table[i][j] < infinity) ? 1 : infinity; } for(int k = 0; k < m; ++k) for(int i = 0; i < m; ++i) for(int j = 0; j < m; ++j) { if(connect[i][j] > connect[i][k] + connect[k][j]){ connect[i][j] = connect[i][k] + connect[k][j]; } } if(connect[a][b] > n){ cout << "Impossible" << endl; continue; } sort(t, t+n); double ans = 1e+30; int Count = 0; do { //double t = Solve(a, b); Solve(a, b); Count++; if(high < ans) ans = high; } while(next_permutation(t, t+n)); if(ans > 1e+20){ cout << "Impossible" << endl; }else{ cout << ans << endl; } } return 0; }