//52
#include<iostream>
#include<queue>
#include<vector>

using namespace std;

struct S{
  int c,v,d;
  bool operator<(S a)const{
    return d>a.d;
  }
};

struct E{
  int t,d,e;
};

int main(){
  for(int n,m,l;cin>>n>>m>>l,n|m|l;){
    vector<E> e[101];
    while(m--){
      int a,b,d,ee;
      cin>>a>>b>>d>>ee;
      E x={b,d,ee};
      e[a].push_back(x);
      x.t=a;
      e[b].push_back(x);
    }
    priority_queue<S> que;
    S is={l,1,0};
    que.push(is);
    bool p[101][101]={{}};
    for(;;){
      S c=que.top();
      if(c.v==n)break;
      que.pop();
      if(p[c.v][c.c]++)continue;
      for(int i=0;i<e[c.v].size();i++){
	S n={c.c,e[c.v][i].t,c.d+e[c.v][i].e};
	que.push(n);
	if(c.c>=e[c.v][i].d){
	  S n={c.c-e[c.v][i].d,e[c.v][i].t,c.d};
	  que.push(n);
	}
      }
    }
    cout<<que.top().d<<endl;
  }
  return 0;
}