#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>

#define NO_ROUTE 1000000

using namespace std;

struct edge {
  //int n;
  int tozoku;
  int dist;
};

struct node {
  int n;
  int money;
  vector<int> visit;
  bool done;
  int tozoku;
  node (int n0 = 0, int money0 = 0, int done0 = false, int tozoku0 = 1000000) {
    n = n0, money = money0, done = done0, tozoku = tozoku0;
  }
  /*push_back(int n) {
    vector.push_back(n);
    } */
  bool operator<(const node &t)const {
    return tozoku > t.tozoku;
  }
};

int N, M, L;
node G[100][101];
edge e[100][100];

int search()
{
  priority_queue<node> que;
  node start(0, L, true, 0);
  //start.push_back(0);
  G[0][L] = node(0, L, true, 0);
  //G[0][L].push_back(0);
  que.push(start);

  while (!que.empty()) {
    node n_node;
    n_node = que.top();
    G[n_node.n][n_node.money].done;
    //cout << "n " << n_node.n << " money " << n_node.money << " done " << n_node.done << " tozoku " << n_node.tozoku << endl;
    que.pop();
    if (n_node.n == N - 1) return n_node.tozoku;
    
    for (int i = 0; i < N; i++) {
      if (e[n_node.n][i].dist == NO_ROUTE) continue;
      //////cout << "dist " << e[n_node.n][i].dist << endl;
      if (!G[i][n_node.money].done) {
	//printf("(%d, %d) : %d %d\n", n_node.n, i, n_node.tozoku + e[i][n_node.money].tozoku, )
	if (n_node.tozoku + e[i][n_node.n].tozoku < G[i][n_node.money].tozoku) {
	  G[i][n_node.money] = node(i, n_node.money, false, n_node.tozoku + e[i][n_node.n].tozoku);
	  ////cout << n_node.tozoku << " + " << e[n_node.n][i].tozoku << endl;
	  node t_node = G[i][n_node.money];
	  //cout << "::n " << t_node.n << " money " << t_node.money << " done " << t_node.done << " tozoku " << t_node.tozoku << endl;
	  que.push(t_node);
	}
      }
      if (n_node.money >= e[n_node.n][i].dist && !G[i][n_node.money - e[n_node.n][i].dist].done 
	  && n_node.tozoku < G[i][n_node.money - e[n_node.n][i].dist].tozoku) {
	G[i][n_node.money - e[n_node.n][i].dist] = node(i, n_node.money - e[n_node.n][i].dist, false, n_node.tozoku);
	node t_node = G[i][n_node.money - e[n_node.n][i].dist];
	//cout << "::n " << t_node.n << " money " << t_node.money << " done " << t_node.done << " tozoku " << t_node.tozoku << endl;
	que.push(t_node);
      }
    }
  }
  return -1;
}


int main()
{
  while (true) {
    scanf("%d %d %d ", &N, &M, &L);
    if (N == 0 && M == 0 && L == 0) break;
    for (int i = 0; i < 100; i++) {
      for (int j = 0; j < 100; j++) {
	G[i][j].n = i;
	G[i][j].money = j;
	G[i][j].tozoku = 1000000;
	G[i][j].done = false;
	e[i][j].dist = NO_ROUTE;
	e[i][j].tozoku = 0;
      }
    }
    
    for (int i = 0; i < 100; i++) {
      G[i][100].tozoku = 1000000;
      G[i][100].n = i;
      G[i][100].done = false;
      G[i][100].money = 100;
    }
    
    for (int i = 0; i < M; i++) {
      int x, y;
      scanf("%d %d ", &x, &y);
      x--, y--;
      scanf("%d %d ", &e[x][y].dist, &e[x][y].tozoku);
      e[y][x].dist = e[x][y].dist, e[y][x].tozoku = e[x][y].tozoku;
    }
    
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
	////cout << e[i][j].dist << " " << e[i][j].tozoku << "   ";
      }
      ////cout << endl;
    }

    cout << search() << endl;
  }
  return 0;
}

Measured memory_bytes: 1512