#include<bits/stdc++.h>
using namespace std;
typedef pair<double,int>p;
int n,m,s,ne[5000001],h[5000001],to[10000001],idx;
bool vis[10000001];
double dis[10000001],w[5000001];
void add(int u,int v,double c){
to[++idx]=v;
w[idx]=1-c;
ne[idx]=h[u];
h[u]=idx;
}void dj(){
dis[s]=1;
priority_queue<p,vector<p>,greater<p> >heap;
heap.push({1.0,s});
while(heap.size()){
int t=heap.top().second;
heap.pop();
if(vis[t])continue;
vis[t]=1;
for(int i=h[t];i!=-1;i=ne[i]){
int j=to[i];
if(dis[j]<dis[t]*w[i]){
dis[j]=dis[t]*w[i];
heap.push({dis[j],j});
}
}
}
}int main(){
memset(h,-1,sizeof h);
cin>>n>>m;
while(m--){
int a,b,c;
cin>>a>>b>>c;
add(a,b,double(c)/100.0);
add(b,a,double(c)/100.0);
}cin>>s;
dj();
cin>>s;
cout<<fixed<<setprecision(8)<<100.0/dis[s]<<'\n';
return 0;
}
求指正