#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>

using namespace std;

typedef pair<int, int> P;

const int N = 100;
const int INF = 1<<28;

class S{
public:
  int p, m, c;
  S(){};
  S(int p, int m, int c) : p(p), m(m), c(c) {}
  bool operator < (const S& s) const {
    if(c == s.c) return m < s.m;
    return c > s.c;
  }
};

int n, m, L, d[N][N+1];
vector<pair<int, P> > G[N];

void dijkstra(int s){
  priority_queue<S> que;
  fill(d[0], d[N], INF);
  d[s][L] = 0;
  que.push(S(0, L, 0));
  while(!que.empty()){
    S u = que.top(); que.pop();
    if(d[u.p][u.m] < u.c) continue;
    for(int i=0;i<G[u.p].size();i++){
      int v = G[u.p][i].first;
      int cost = G[u.p][i].second.second;
      if(d[v][u.m] > d[u.p][u.m] + cost){
        d[v][u.m] = d[u.p][u.m] + cost;
        que.push(S(v, u.m, d[v][u.m]));
      }
      int nm = u.m - G[u.p][i].second.first;
      if(nm >= 0 && d[v][nm] > d[u.p][u.m]){
        d[v][nm] = d[u.p][u.m];
        que.push(S(v, nm, d[v][nm]));
      }
    }
  }
}

int main(){
  while(cin >> n >> m >> L && (n|m|L)){
    for(int i=0;i<N;i++) G[i].clear();
    for(int i=0;i<m;i++){
      int a, b, d, e;
      cin >> a >> b >> d >> e;
      a--; b--;
      G[a].push_back(make_pair(b, P(d, e)));
      G[b].push_back(make_pair(a, P(d, e)));
    }
    dijkstra(0);
    int ans = INF;
    for(int i=0;i<=L;i++) ans = min(ans, d[n-1][i]);
    cout << ans << endl;
  }
}