#include <bits/stdc++.h>
using namespace std;
 
#define int long long
using P = pair<int, int>;
using Pip = pair<int, P>;

struct edge {
  int to, d, e;
  edge(int to, int d, int e): to(to), d(d), e(e) {}
};

int N, M, L;
vector<edge> G[101];

int dij() {
  bool used[101][101];
  fill_n(*used, 101*101, false);
  priority_queue<Pip, vector<Pip>, greater<Pip> > Q;
  Q.push(Pip(0, P(0, L)));
  while ( !Q.empty() ) {
    Pip p = Q.top(); Q.pop();
    int cost = p.first, v = p.second.first, l = p.second.second;

    if ( v == N-1 ) return cost;

    if ( used[v][l] ) continue;
    used[v][l] = true;

    for ( edge e: G[v] ) {
      if ( e.d <= l ) {
	Q.push(Pip(cost, P(e.to, l-e.d)));
      }
      Q.push(Pip(cost+e.e, P(e.to, l)));
    }
  }

  assert(0);
}

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while ( cin >> N >> M >> L, N ) {
    for ( int i = 0; i < 101; 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(edge(b, d, e));
      G[b].push_back(edge(a, d, e));
    }
    
    cout << dij() << endl;
  }
  
  return 0;
}

