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

#define rep(X,Y) for(int (X)=0;(X)<(Y);++(X))
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define pb push_back

using namespace std;

struct edge {int to, cost, pp;};

typedef pair<int, int> P;
typedef pair<int, P> PIP;

#define MAX_V 101
#define MAX_L 101
#define INF 1000000000

vector<edge> G[MAX_V];
int d[MAX_L][MAX_V];

int l,n,m;


void dij(){
	priority_queue<PIP, vector<PIP>, greater<PIP> > q;
	
	d[l][1] = 0;
	q.push(PIP(0,P(l,1)));
	while(!q.empty()){
		PIP p = q.top();q.pop();
		int ll = p.second.first;
		int v = p.second.second;
		if(ll < 0)continue;
		if(d[ll][v] < p.first)continue;
		rep(i,G[v].size()){
			edge e = G[v][i];
			if(d[ll][e.to] > d[ll][v] + e.pp ){
				d[ll][e.to] = d[ll][v] + e.pp;
				q.push(PIP(d[ll][e.to],P(ll,e.to)));
			}
			if( ll-e.cost < 0)continue;
			if(d[ll-e.cost][e.to] > d[ll][v]){
				d[ll-e.cost][e.to] = d[ll][v];
				q.push(PIP(d[ll-e.cost][e.to],P(ll-e.cost,e.to)));
			}
		}
	}
}

void init(){
	l = n = m = 0;
	rep(i,101)G[i].clear();
	rep(i,101)rep(j,101)d[i][j] = INF;
}

	


int main(){
	while(1){
		int ans = INF;
		init();
		cin >> n >> m >> l;
		if(!n)break;
		rep(i,m){
			int a,b,d,e;
			cin >> a >> b >> d >> e;
			G[a].push_back((edge){b,d,e});
			G[b].push_back((edge){a,d,e});
		}
		dij();
		rep(i,l+1){
			ans = min(ans, d[i][n]);
		}
		cout << ans << endl;

	}
}