#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
using namespace std;
//英语 看博友分析 抄博友程序 spfa像bfs Bellman_Ford未实现 找标准spfa背
double d[108];
int inq[108];//在队列中
struct nod{
int to;
double r;
double c;
};
vector<nod> G[108];
int main()
{
int n,m,root;
double money;
scanf("%d%d%d%lf",&n,&m,&root,&money);
for(int i=0;i<m;i++)
{
int x,y;
double r,c;
scanf("%d%d%lf%lf",&x,&y,&r,&c);
G[x].push_back((nod){y,r,c});//抄博友程序
scanf("%lf%lf",&r,&c);
G[y].push_back((nod){x,r,c});
}
queue<int> que;
que.push(root);
d[root]=money;//抄博友
inq[root]=1;//抄博友
while(que.empty()!=1)
{
int u=que.front();
que.pop();
inq[u]=0;
for(int i=0;i<G[u].size();i++)
{
int v=G[u][i].to;
double tr=G[u][i].r;
double tc=G[u][i].c;
if(d[v]<(d[u]-tc)*tr)//
{
d[v]=(d[u]-tc)*tr;
if(inq[v]==0)
{
inq[v]=1;
que.push(v);
}
}
}
}
if(d[root]>money)
{
cout<<"YES"<<endl;
}else
{
cout<<"NO"<<endl;
}
return 0;
}