#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#define INF 10000000
#define MN 101
using namespace std;
typedef long long ll;

typedef struct P
{
	int pos,mon,eve;
	bool operator <(const P &a)const{ return eve>a.eve;};
}P;
typedef struct E{int to,cost,eve;}E;

int N,M,L;
int amb[MN][MN];
vector<E> G[MN];

int bfs(int s,int t,int y)
{
	int r=INF;
	priority_queue<P>Q;
	memset(amb,0x7f,sizeof(amb));
	amb[s][y]=0;
	P p={s,y,0};
	Q.push(p);
	for(;!Q.empty();)
	{
		p=Q.top();Q.pop();
		if(p.pos==t)
		{
			r=min(r,p.eve);
			return p.eve;
			continue;
		}
		for(int i=0;i<G[p.pos].size();i++)
		{;
			E np=G[p.pos][i];
			if(amb[np.to][p.mon]>p.eve+np.eve)//not gard
			{
				amb[np.to][p.mon]=p.eve+np.eve;
				P ins={np.to,p.mon,amb[np.to][p.mon]};
				Q.push(ins);
			}
			if(p.mon>=np.cost&&amb[np.to][p.mon-np.cost]>p.eve)//hire gard
			{
				amb[np.to][p.mon-np.cost]=p.eve;
				P ins={np.to,p.mon-np.cost,amb[np.to][p.mon-np.cost]};
				Q.push(ins);
			}
		}
	}
	return r;
}

int main()
{
	for(;scanf("%d%d%d",&N,&M,&L),N+M+L;)
	{
		for(int i=0;i<MN;i++)G[i].clear();
		for(int i=0;i<M;i++)
		{
			int s,t,l,e;
			scanf("%d%d%d%d",&s,&t,&l,&e);
			s--;t--;
			E tmp={t,l,e};
			G[s].push_back(tmp);
			tmp.to=s;
			G[t].push_back(tmp);
		}
		printf("%d\n",bfs(0,N-1,L));
	}
}