#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define INF 100000000
#define EPS 1e-10
#define MOD 1000000007
using namespace std;
typedef pair<int,int> P;

struct E{
	int to, len, num;
};

int n, m, l;
int cost[100][200];
vector<E> edge[100];

void solve(){
	rep(i,100) rep(j,200) cost[i][j] = INF;
	rep(i,100) edge[i].clear();
	rep(i,m){
		int a, b, d, e;
		cin >> a >> b >> d >> e;
		a--; b--;
		edge[a].push_back((E){b,d,e});
		edge[b].push_back((E){a,d,e});
	}
	cost[0][l] = 0;
	priority_queue<P, vector<P>, greater<P> > que;
	que.push(P(0,l));
	while(true){
		if(que.size() == 0) break;
		P q = que.top();
		que.pop();
		int v = q.second/1000, co = q.second%1000;
		rep(i,edge[v].size()){
			E e = edge[v][i];
			if(co >= e.len && cost[e.to][co-e.len] > cost[v][co]){
				cost[e.to][co-e.len] = cost[v][co];
				que.push(P(cost[e.to][co-e.len],e.to*1000+co-e.len));
			}
			if(cost[e.to][co] > cost[v][co]+e.num){
				cost[e.to][co] = cost[v][co]+e.num;
				que.push(P(cost[e.to][co],e.to*1000+co));
			}
		}
	}
	int ans = INF;
	rep(i,200) ans = min(ans,cost[n-1][i]);
	cout << ans << endl;
}

int main(){
	while(true){
		cin >> n >> m >> l;
		if(n==0&&m==0&&l==0) break;
		solve();
	}
}