#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
struct edge{
  int to, cost, num;
};
typedef pair<int, int> pii;
typedef pair<int, pii> piii;//num, cost, vertex
int main(){
  int n, m, l;
  while(cin >> n >> m >> l, n){
    priority_queue<piii, vector<piii>, greater<piii> > que;
    vector<vector<edge> >G(n + 1);
    int dp[n + 1][l + 1];
    for(int i = 0; i <= n; i++){
      for(int j = 0; j <= l; j++){
	dp[i][j] = 1e9;
      }
    }
    for(int i = 0; i < m; i++){
      edge e;
      int from;
      cin >> from >> e.to >> e.cost >> e.num;
      G[e.to].push_back((edge){from, e.cost, e.num});
      G[from].push_back(e);
    }
    dp[1][l] = 0;
    que.push(mp(0, mp(l, 1)));
    while(!que.empty()){
      piii tmp = que.top();que.pop();
      int num = tmp.first;
      int c = tmp.second.first;
      int v = tmp.second.second;
      for(int i = 0; i < G[v].size(); i++){
	int nv = G[v][i].to;
	if(dp[nv][c] > num + G[v][i].num){
	  dp[nv][c] = num + G[v][i].num;
	  que.push(mp(dp[nv][c], mp(c, nv)));
	}
	if(c - G[v][i].cost >= 0 &&
	   dp[nv][c - G[v][i].cost] > num){
	  dp[nv][c - G[v][i].cost] = num;
	  que.push(mp(num, mp(c - G[v][i].cost, nv)));
	}
      }
    }
    int ans = 1e9;
    for(int i = 0; i <= l; i++){
      ans = min(ans, dp[n][i]);
    }
    // for(int i = 0; i <=n; i++){
    //   for(int j = 0; j <=l; j++){
    // 	if(dp[i][j] == 1e9){
    // 	  printf("INF ");
    // 	  continue;
    // 	}
    // 	printf("%3d ", dp[i][j]);
    //   }
    //   cout << endl;
    // }
    // cout << endl;
    cout << ans << endl;
  }
}