#include <bits/stdc++.h>
using namespace std;
#define F(i,l,r) for(int i=l;i<=r;i++)
#define ll long long
char p[10000];
int res=0;
int main()
{
    int m,t,n;
    cin >> n >> m >> t;
    int vt=0;
    int cnt=n;
    F(i,1,m)
    {
        int x,y;
        cin >> x >> y;
        cnt-=(x-vt);
        if(cnt<=0) break;
        cnt=min(n,cnt+(y-x));
        vt=y;
    }
    cnt-=(t-vt);
 //   cout << n << endl;
    if(cnt>0) cout << "Yes";
    else cout << "No";
    return 0;
}

#include <bits/stdc++.h>
#define N 200005
#define M 400005
#define inf 1e18
#define mp make_pair
#define int long long
using namespace std;
int n,m;
int head[N],v[M],C[M],D[M],nxt[M],tot;
priority_queue<pair<int,int> > q;
int dis[N];
bool vis[N];
int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=(x<<1)+(x<<3)+(c^48);
		c=getchar();
	}
	return x*f;
}
inline void add(int x,int y,int c,int d)
{
	tot++;
	v[tot]=y;
	C[tot]=c;
	D[tot]=d;
	nxt[tot]=head[x];
	head[x]=tot;
}
inline int Dij(int s)
{
	for(int i=2;i<=n;i++) dis[i]=inf;
	dis[s]=0;
	q.push(mp(0,s));
	while(!q.empty())
	{
		int x=q.top().second,s=q.top().first;q.pop();
		if(x==n) return -s;

		if(vis[x]) continue;
		vis[x]=1;
		for(int i=head[x];i;i=nxt[i])
		{
			if(dis[v[i]]>((dis[x]>floor(sqrt(D[i]+1))-1)?dis[x]+C[i]+(D[i]/(dis[x]+1)):floor(sqrt(D[i]+1))-1+C[i]+(D[i]/(floor(sqrt(D[i]+1))))))
		    {
				dis[v[i]]=((dis[x]>floor(sqrt(D[i]+1))-1)?dis[x]+C[i]+(D[i]/(dis[x]+1)):floor(sqrt(D[i]+1))-1+C[i]+(D[i]/(floor(sqrt(D[i]+1)))));
				q.push(mp(-dis[v[i]],v[i]));
			}
		}
	}
	return -1;
}
signed main()
{
	n=read();
	m=read();
	int a,b,c,d;
	for(int i=1;i<=m;i++)
	{
		a=read();
		b=read();
		c=read();
		d=read();
		//if(a==b) continue;
		add(a,b,c,d);
		add(b,a,c,d);
	}
	printf("%lld\n",Dij(1));
	return 0;
}