#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

struct state {
	int p, l, c;
	state(int p, int l, int c) : p(p), l(l), c(c) {};
	bool operator<(const state &o)const {
		return o.c<c;
	}
};

int main() {
	int N, M, L;
	while(cin >> N >> M >> L, N) {
		int A, B, D, E;
		vvi dist(N, vi(N, INF)), enemy(N, vi(N, INF));
		REP(i, M) {
			cin >> A >> B >> D >> E;
			dist[A-1][B-1] = dist[B-1][A-1] = D;
			enemy[A-1][B-1] = enemy[B-1][A-1] = E;
		}

		vvi cost(N, vi(L+1, INF));
		priority_queue<state> Q;
		Q.push(state(0, L, 0));
		int ans = INF;
		while(!Q.empty()) {
			state st = Q.top();
			Q.pop();

			if(st.p == N-1) {
				ans = min(ans, st.c);
				continue;
			}

			REP(t, N) {
				if(st.p != t && dist[st.p][t] != INF) {
					if(dist[st.p][t] <= st.l) {
						int nl = st.l-dist[st.p][t];
						if(st.c < cost[t][nl]) {
							cost[t][nl] = st.c;
							Q.push(state(t, nl, st.c));
						}
					}
					int nc = st.c+enemy[st.p][t];
					if(nc < cost[t][st.l]) {
						cost[t][st.l] = nc;
						Q.push(state(t, st.l, nc));
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}