// Original C++ solution (slower):
#include <stdio.h>

#include <iostream>

#include <vector>

#include <list>

#include <cmath>

#include <fstream>

#include <algorithm>

#include <string>

#include <queue>

#include <set>

#include <map>

#include <complex>

#include <iterator>

#include <cstdlib>

#include <sstream>



using namespace std;



#define EPS (1e-10)

#define EQ(a,b) (abs((a) - (b)) < EPS)

#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))



typedef long long ll;



const int MAX_SIZE = 10000;



struct edge{

	int to;

	int cost;

	int enemy;

};



class Situation{

public:

	int cost;

	int node;

	int money;



	Situation(int cost_,int node_,int money_){

		cost=cost_;

		node=node_;

		money=money_;

	}

	Situation();



	bool operator<(const Situation &s)const{

		return s.cost < this->cost;

	}

};



int V;



const int MAX_V = 101;



vector<edge> G[MAX_V][MAX_V];

//  éêÉ écèàzÅ½Çè­Å¬RXg

int d[MAX_V][MAX_V];

const int INF = 100000000;



//int prevv[MAX_V];

int L;

int N;

int M;



void dijkstra(int s){

	priority_queue<Situation> que;

	for(int i = 0; i < MAX_V; i++)

		fill(d[i],d[i]+MAX_V,INF);

	d[s][L] = 0;

	que.push(Situation(0,s,L));

	while(!que.empty()){

		Situation p = que.top();

		que.pop();

		int node = p.node;

		int money=p.money;

		if(d[node][money] < p.cost)

			continue;

		for(int i = 0; i < G[node][money].size(); i++){

			edge e = G[node][money][i];

			// ¨àðgÁÄìµÄàç¤ê

			if(money-e.cost>=0){

				if(d[e.to][money-e.cost] > d[node][money]){

					d[e.to][money-e.cost] = d[node][money];

					que.push(Situation(d[e.to][money-e.cost],e.to,money-e.cost));

				}

			}

			// ìÈµÌê

			if(d[e.to][money]>d[node][money]+e.enemy){

				d[e.to][money]=d[node][money]+e.enemy;

				que.push(Situation(d[e.to][money],e.to,money));

			}

		}

	}

}



int main(){



	while(cin>>N>>M>>L&&!(N==0&&M==0&&L==0)){

		for(int i = 0; i < MAX_V; i++)

			for(int j = 0; j < MAX_V; j++)

				G[i][j].clear();

		int from,to,cost,enemy;

		for(int i = 0; i < M; i++){

			cin>>from>>to>>cost>>enemy;

			from--;

			to--;

			edge e;

			e.cost=cost;

			e.to=to;

			e.enemy=enemy;

			

			for(int i = 0; i < MAX_V; i++)

				G[from][i].push_back(e);

			e.to=from;

			for(int i = 0; i < MAX_V; i++)

				G[to][i].push_back(e);

		}

		dijkstra(0);

		int minCost=INF;

		for(int i = 0; i < MAX_V; i++)

			minCost=min(minCost,d[N-1][i]);

		cout<<minCost<<endl;

	}



	return 0;

}

// Optimized solution to the same problem (faster):
#include <iostream>

#include <cstdio>

#include <vector>

#include <list>

#include <cmath>

#include <fstream>

#include <algorithm>

#include <string>

#include <queue>

#include <set>

#include <map>

#include <complex>

#include <iterator>

#include <cstdlib>

#include <cstring>

#include <sstream>

#include <stack>

#include <climits>



using namespace std;

typedef long long ll;

typedef pair<int,int> pii;

double EPS=1e-10;

double EQ(double a,double b){

	return abs(a-b)<EPS;

}



struct edge{

	int to;

	int enm;

	int dist;

};

int N,M,L;

vector<edge> G[201];

int d[201][201];

typedef pair<int,pii> ppi;

const int INF=1000000000;



int dijkstra(){

	for(int i=0;i<200;i++)

		for(int j=0;j<200;j++)

			d[i][j]=INF;

	d[0][L]=0;

	priority_queue<ppi,vector<ppi>,greater<ppi> > pq;

	pq.push(make_pair(0,pii(0,L)));

	while(pq.size()){

		ppi p=pq.top();pq.pop();

		int ccost=p.first;

		int cnode=p.second.first;

		int cmoney=p.second.second;

		if(d[cnode][cmoney]<ccost)continue;

		for(int i=0;i<G[cnode].size();i++){

			edge &e=G[cnode][i];

			int nnode=e.to;

			// ツづ「ツづ?つ、

			if(e.dist<=cmoney){

				int ncost=ccost;

				int nmoney=cmoney-e.dist;

				if(d[nnode][nmoney]>ncost){

					d[nnode][nmoney]=ncost;

					pq.push(make_pair(ncost,pii(nnode,nmoney)));

				}

			}

			// ツづ「ツづ?づュツづ按つ「

			{

				int ncost=ccost+e.enm;

				int nmoney=cmoney;

				if(d[nnode][nmoney]>ncost){

					d[nnode][nmoney]=ncost;

					pq.push(make_pair(ncost,pii(nnode,nmoney)));

				}

			}

		}

	}

	int res=INF;

	for(int i=0;i<=L;i++){

		res=min(res,d[N-1][i]);

	}

	return res;

}



void solve(){

	while(cin>>N>>M>>L&&(N|M|L)){

		for(int i=0;i<201;i++)G[i].clear();

		for(int i=0;i<M;i++){

			int from,to,enm,dist;

			cin>>from>>to>>dist>>enm;

			from--;to--;

			edge e;

			e.dist=dist;

			e.to=to;

			e.enm=enm;

			G[from].push_back(e);

			e.to=from;

			G[to].push_back(e);

		}

		int res=dijkstra();

		cout<<res<<endl;

	}

}

int main(){

	solve();

	return 0;

}

// Fastest known solution for this problem: