// AOJ 2151: Brave Princess Revisited
// 2017.11.11 bal4u
// 2018.2.6

#include <stdio.h>
#include <string.h>

typedef struct { int t, n, m; } QUE;
QUE que[20001]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;
	
	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i]; que[i] = que[min]; que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
//	if (qsize == 0) return 0;
//	*n = que[0].n, *m = que[0].m;
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int t, int n, int m)
{
	int i, min;
	QUE qt;
	
	i = qsize++;
	que[i].t = t, que[i].n = n, que[i].m = m;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i]; que[i] = que[min]; que[min] = qt;
		i = min;
	}
}

int to[101][101], d[101][101], e[101][101], hi[101];
int node[101][101];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int dijkstra(int start, int goal, int l)
{
	int s, m, i, k, t, p, ans;

	memset(node, 0x33, sizeof(node));
	ans = 0x7fffff;
	qsize = 0;
	node[start][l] = 0; enq(0, start, l);

	while (qsize) {
		s = que[0].n, m = que[0].m, deq();
		p = node[s][m];

		if (s == goal) {
			if (p < ans) ans = p;
			if (ans == 0) break;
			continue;
		}

		for (i = 0; i < hi[s]; i++) {
			t = to[s][i];

			k = p + e[s][i];
			if (k < node[t][m]) node[t][m] = k, enq(node[t][m], t, m);

			k = m - d[s][i];
			if (d[s][i] <= m && p < node[t][k]) node[t][k] = p, enq(node[t][k], t, k);
		}
	}
	return ans;
}

int main()
{
	int n, m, l, k, a, b, _d, _e, i;

	while (n = in()) {
		m = in(), l = in();
		memset(hi, 0, n << 2);
		for (i = 0; i < m; i++) {
			a = in()-1, b = in()-1, _d = in(), _e = in();
			k = hi[a]++;
			to[a][k] = b, d[a][k] = _d, e[a][k] = _e;
			k = hi[b]++;
			to[b][k] = a, d[b][k] = _d, e[b][k] = _e;
		}
		printf("%d\n", dijkstra(0, n-1, l));
	}
	return 0;
}
