#include<iostream>
#include<queue>
#include<vector>
#include<utility>
#include<functional>

using namespace std;

typedef pair<int, int> P;

struct State {
	int enemy, town, cost;
	State(int _enemy, int _town, int _cost) {
		enemy = _enemy;
		town = _town;
		cost = _cost;
	}
};

struct Road {
	int to, cost, enemy;
	Road(int _to, int _cost, int _enemy) {
		to = _to;
		cost = _cost;
		enemy = _enemy;
	}
};

int N, M, L;
vector<Road> road[100];

int dijkstra() {
	vector<vector<int>>d(100, vector<int>(101, 1000000000));
	auto comp = [](const State& s1, const State& s2) {return s1.enemy > s2.enemy; };
	priority_queue<State, vector<State>, decltype(comp)> q(comp);
	d[0][0] = 0;
	q.push(State(0, 0, 0));
	while (!q.empty()) {
		State s = q.top(); q.pop();
		if (s.town == N - 1)return s.enemy;
		if (d[s.town][s.cost] < s.enemy)continue;
		for (int i = 0; i < road[s.town].size(); i++) {
			Road r = road[s.town][i];
			if (d[r.to][s.cost] > d[s.town][s.cost] + r.enemy) {
				d[r.to][s.cost] = d[s.town][s.cost] + r.enemy;
				q.push(State(d[r.to][s.cost], r.to, s.cost));
			}
			if (r.cost + s.cost > L)continue;
			if (d[r.to][s.cost + r.cost] > d[s.town][s.cost]) {
				d[r.to][s.cost + r.cost] = d[s.town][s.cost];
				q.push(State(d[r.to][s.cost + r.cost], r.to, s.cost + r.cost));
			}
		}
	}
}

int main() {
	while (cin >> N >> M >> L, N) {
		for (int i = 0; i < M; i++) {
			int a, b, d, e;
			cin >> a >> b >> d >> e;
			road[a - 1].push_back(Road(b - 1, d, e));
			road[b - 1].push_back(Road(a - 1, d, e));
		}
		cout << dijkstra() << endl;
		for (int i = 0; i < 100; i++) {
			road[i].clear();
		}
	}
}