#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>

#define INF 0x7fffffff

using namespace std;

struct edge{
	int to, D, E;
	edge(int t, int d, int e){
		to = t;
		D = d;
		E = e;
	}
};


int main(){
	int N, M, L, A, B, D, E;

	while( cin>>N>>M>>L, N|M|L ){
		priority_queue<pair<int, pair<int,int> >,vector<pair<int, pair<int, int> > >,greater<pair<int,pair<int,int> > > > que;
		vector<edge> v[105];
		int dh[105][105];
		for(int i=0; i<M; i++){
			cin >> A >> B >> D >> E;
			v[A].push_back( edge(B, D, E) );
			v[B].push_back( edge(A, D, E) );
		}
		fill(dh[0], dh[0]+105*105, INF);
		
		que.push( make_pair(0, make_pair(1,L)) );
		while( !que.empty() ){
			pair<int, pair<int,int> > P = que.top();
			que.pop();
			int Psf = P.second.first, Pss = P.second.second;
			if( P.first < dh[Psf][Pss] ){
				dh[Psf][Pss] = P.first;
				for(int i=0; i<v[Psf].size(); i++){
					edge e = v[Psf][i];
					que.push( make_pair(P.first + e.E, make_pair(e.to, Pss)) );
					if( e.D <= Pss ){
						que.push( make_pair(P.first, make_pair(e.to, Pss-e.D)) );
					}
				}
			}
		}

		int ans = INF;
		for(int i=0; i<=L; i++)
			ans = min(ans, dh[N][i]);

		cout << ans << endl;
	}
	return 0;
}