#include <bits/stdc++.h>
#define inf (int)1e9
using namespace std;

struct data {
  int p, d, c;
};
bool operator<(const data &l, const data &r) {
  if(l.c != r.c) return l.c > r.c;
  if(l.d != r.d) return l.d > r.d;
  return l.p > r.p;
}

int n, m, l;
int dp[105][105] = {0};
vector<data> edges[105];
priority_queue<data> pq;

int solve();

int main() {
  while(1) {
    cin >> n >> m >> l;
    if(n + m + l == 0) break;
    for(int i = 0; i < m; ++i) {
      int a, b, d, e;
      cin >> a >> b >> d >> e;
      edges[--a].push_back({--b, d, e});
      edges[b].push_back({a, d, e});
    }
    cout << solve() << endl;
    for(int i = 0; i < n; ++i)
      edges[i].erase(edges[i].begin(), edges[i].end());
  }
  return 0;
}

int solve() {
  for(int i = 0; i < n; ++i)
    for(int k = 0; k <= l; ++k) dp[i][k] = inf;
  pq.push({0, 0, 0});
  while(pq.size() > 0) {
    data now = pq.top();
    pq.pop();
    if(dp[now.p][now.d] <= now.c) continue;
    dp[now.p][now.d] = now.c;
    for(int i = 0; i < edges[now.p].size(); ++i) {
      data nextp = now;
      nextp.p = edges[now.p][i].p;
      if(edges[now.p][i].c != 0)
        nextp.d += edges[now.p][i].d;
      if(nextp.d <= l) pq.push(nextp);
      nextp.d = now.d;
      nextp.c += edges[now.p][i].c;
      pq.push(nextp);
    }
  }
  int ans = inf;
  for(int i = 0; i <= l; ++i) ans = min(ans, dp[n - 1][i]);
  return ans;
}
