// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

const size_t SIZE = 110;
const size_t MAX_N = SIZE * SIZE;
const ll inf = 5e15;

ll make_id(ll n, ll c) {
    return c * SIZE + n;
}

ll dists[MAX_N];
V<TLL> edges[SIZE];

bool solve() {
    ll N, M, L;
    cin >> N >> M >> L;
    if (!(N + M + L)) return false;
    fill(dists, dists + MAX_N, inf);
    for (ll i = 0; i < SIZE; i++) edges[i].clear();
    for (ll i = 0; i < M; i++) {
        ll a, b, d, e;
        cin >> a >> b >> d >> e;
        a--; b--;
        edges[a].emplace_back(b, d, e);
        edges[b].emplace_back(a, d, e);
    }
    dists[make_id(0, 0)] = 0;
    priority_queue<PLL, V<PLL>, greater<PLL>> pq;
    pq.emplace(0, 0);
    while (pq.size()) {
        ll cur_d, cur_n;
        tie(cur_d, cur_n) = pq.top();
        pq.pop();
        if (dists[cur_n] < cur_d) continue;
        ll n = cur_n % SIZE;
        ll used = cur_n / SIZE;
        for (auto &&e : edges[n]) {
            ll a, b, c;
            tie(a, b, c) = e;
            ll nxt_cl[] = { used + b, used, };
            ll nxt_dl[] = { cur_d, cur_d + c, };
            for (ll i = 0; i < 2; i++) {
                ll nxt_c = nxt_cl[i];
                ll nxt_d = nxt_dl[i];
                ll nid = make_id(a, nxt_c);
                if (L < nxt_c) continue;
                if (dists[nid] <= nxt_d) continue;
                dists[nid] = nxt_d;
                pq.emplace(nxt_d, nid);
            }
        }
    }

    ll ans = inf;
    for (ll i = 0; i <= L; i++) chmin(ans, dists[make_id(N - 1, i)]);
    cout << ans << endl;
    return true;
}

int main() {
    while (solve());
    return 0;
}



Measured memory_bytes: 3988