#include<iostream>
#include<queue>
#include<vector>
using namespace std;
const int infty = 1<<28;
struct Node{
  vector<int> con;
  vector<int> cost;
  vector<int> dist;
};
struct State{
  int L;
  int cost;
  int now;
  State():now(-1),cost(infty),L(-1){}
  State(int pos,int cost, int L):now(pos),cost(cost),L(L){}
  bool operator>(const State &t)const{return cost>t.cost;}
};
typedef vector<Node> Graph;
int dijkstra(int s, int g, int L, Graph &G){
  int A[G.size()][L+1];
  bool vis[G.size()][L+1];
  for(int i = 0; i < G.size(); ++i){
    for(int j = 0; j < L+1; ++j){
      A[i][j]=infty;
      vis[i][j]=false;
    }
  }
  priority_queue<State,vector<State>,greater<State> > Q;
  Q.push( State(s,0,L) );
  if(s==g)return 0;
  while(!Q.empty()){
    State now = Q.top(); Q.pop();
    if(vis[now.now][now.L])continue;
    vis[now.now][now.L]=true;
    for(int i = 0; i < G[now.now].con.size(); ++i){
      int next_id = G[now.now].con[i];
      for(int k = 0; k < 2; ++k){
	int next_L = now.L - G[now.now].dist[i];
	int costi = G[now.now].cost[i];
	if(k==1)next_L=now.L;
	if(k==0)costi=0;
	if(next_L>=0){
	  if( now.cost+costi<A[next_id][next_L] ){
	    A[next_id][next_L]=now.cost+costi;
	    if(!vis[next_id][next_L]){
	      Q.push(State(next_id,A[next_id][next_L],next_L));
	    }
	  }
	}
      }
    }
  }
  int ret=infty;
  for(int i = 0; i < L+1; ++i){
    ret=min(ret,A[g][i]);
  }
  return ret;
}


int main()
{
  int N,M,L;
  while(cin>>N>>M>>L&&N){
    Graph G(N);
    for(int i = 0; i < M; ++i){
      int A,B,D,E;
      cin >> A >> B >> D >> E;
      --A;--B;
      G[A].con.push_back(B);
      G[A].cost.push_back(E);
      G[A].dist.push_back(D);
      G[B].con.push_back(A);
      G[B].cost.push_back(E);
      G[B].dist.push_back(D);
    }
    cout << dijkstra(0,N-1,L,G) << endl;
  }
  return 0;
}