//Time 16ms, Memory 244K
#include<iostream>
#include<cstring>
using namespace std;
int cnt,n,m,s;
double v;
struct point
{
int a,b;
double r,c;
point(int a=0,int b=0,double r=0.0,double c=0.0):a(a),b(b),r(r),c(c){}
}p[201];
int bellman()
{
int i,j;
int flag;
double dis[101];
memset(dis,0,sizeof(dis));
dis[s]=v;
for(i=1;i<n;i++)
{
flag=0;
for(j=0;j<cnt;j++)
{
if(dis[p[j].b]<(dis[p[j].a]-p[j].c)*p[j].r)
{
dis[p[j].b]=(dis[p[j].a]-p[j].c)*p[j].r;flag=1;
}
}
if(!flag) break;
}
for(j=0;j<cnt;j++)
{
if(dis[p[j].b]<(dis[p[j].a]-p[j].c)*p[j].r) return 1;
}
return 0;
}
int main()
{
int i,a,b;
double r1,r2,c1,c2;
cin>>n>>m>>s>>v;
cnt=0;
for(i=0;i<m;i++)
{
cin>>a>>b>>r1>>c1>>r2>>c2;
p[cnt++]=point(a,b,r1,c1);
p[cnt++]=point(b,a,r2,c2);
}
if(bellman()) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}