#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
using namespace std;

#define INF 1111111111
#define F first
#define S second

struct edge {
  int to, cost, thief;
  edge(int _to, int _cost, int _thief) {to=_to; cost=_cost; thief=_thief;}
};
typedef pair<int, int> PI;
typedef pair<int, PI> P;

int n, m, l;
vector<edge> G[128];
int d[128][128];

void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P> > que;
  fill(d[0], d[0] + 128 * 128, INF);
  d[l][s] = 0;
  que.push(P(l, PI(0, s)));

  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.S.S, w = p.F;
    if(d[w][v] < p.S.F) continue;
    for(int i = 0;i < G[v].size(); i++){
      edge e = G[v][i];
      if(d[w][e.to] > d[w][v] + e.thief){
	d[w][e.to] = d[w][v] + e.thief;
	que.push(P(w, PI(d[w][e.to],e.to)));
      }
      if(w >= e.cost && d[w-e.cost][e.to] > d[w][v]){
	d[w-e.cost][e.to] = d[w][v];
	que.push(P(w-e.cost, PI(d[w-e.cost][e.to],e.to)));
      }
    }
  }
}

int main(void){
  int A, B, D, E;
  for( ; ; ){
    scanf("%d %d %d", &n, &m, &l);
    if(!(n + m + l)) break;
    for(int i = 0;i <= n; i++) G[i].clear();
    for(int i = 0;i < m; i++){
      scanf("%d %d %d %d", &A, &B, &D, &E);
      G[A].push_back(edge(B,D,E));
      G[B].push_back(edge(A,D,E));
    }

    dijkstra(1);
    int ans = INF;
    for(int i = 0;i <= l; i++) ans = min(ans, d[i][n]);
    printf("%d\n", ans);
  }
}
