#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
#include<queue>
#include<string>
#include<sstream>

using namespace std;

class Graph{
private:
    struct Node {
        int index;
        bool done;
        long long dist;
        vector<pair<int, int>> adj;
        Node() : done(false), dist(INF) {}

        bool operator>(const Node& another) const {
            return dist > another.dist;
        }
    };

    vector<Node> nodes;

    void range_check(int i) {
        if (i < 0 || i >= n) {
            cout << "dijkstra: Invalid node index: " << i << endl;
            throw "Exception";
        }
    }
public:
    const static long long INF = 1LL << 62;
    const int n;

    // n nodes directed graph
    Graph(int _n) : n(_n) {
        nodes = vector<Node>(_n);
        for (int i = 0; i < _n; ++i) {
            nodes[i].index = i;
        } 
    }

    // add directed edge from u-th node to v-th node
    void addEdge(int u, int v, int w) {
        range_check(u);
        range_check(v);
        nodes[u].adj.push_back(make_pair(v, w));
        if (w < 0) {
            cout << "dijkstra: All weights must be positive: " << w << " (" << u << " -- " << v << ")" << endl;
            throw "Exception";
        }
    }

    // add undirected edge between u-th node and v-th node
    void addUndirectedEdge(int u, int v, int w) {
        addEdge(u, v, w);
        addEdge(v, u, w);
    }

    // calculate shortest distance from s-th node
    void dijkstra(int s) {
        range_check(s);

        priority_queue<Node, vector<Node>, greater<Node>> pq;

        nodes[s].dist = 0;
        pq.push(nodes[s]);

        while (!pq.empty()) {
            Node top = pq.top();
            pq.pop();
            top.done = true;

            int u = top.index;
            // D(u);
            for (pair<int, int> p : top.adj) {
                int v = p.first;
                int w = p.second;
                if (nodes[v].done) continue;

                long long newdist = nodes[u].dist + (long long)w;
                if (nodes[v].dist > newdist) {
                    nodes[v].dist = newdist;
                    pq.push(nodes[v]);
                }
            }
        }
    }

    // shortest distance to i
    long long shortestDistTo(int i) const {
        return nodes[i].dist;
    }

    // dump this graph
    string dump() const {
        ostringstream os;
        os << "node -> adj-node(distance), ..." << endl;
        for (Node node : nodes) {
            os << node.index << " -> ";
            for (pair<int, int> p : node.adj) {
                os << p.first << "(" << p.second << "), " << node.dist;
            }
            os << endl;
        }
        return os.str();
    }
};

int n, m, l;
int nodei(int i, int li) {
    return i + li * n;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    while(1) {
        cin >> n >> m >> l;
        if (n == 0) break;
        auto g = Graph(n * (l + 1));
        REP(i, m) {
            int a, b, d, e;
            cin >> a >> b >> d >> e;
            a--;
            b--;
            REP(li, l + 1) g.addUndirectedEdge(nodei(a, li), nodei(b, li), e);
            REP(li, l + 1) {
                if (li + d > l) break;
                g.addEdge(nodei(a, li + d), nodei(b, li), 0);
                g.addEdge(nodei(b, li + d), nodei(a, li), 0);
            }
        }
        long long ans = 1LL << 62;
        g.dijkstra(nodei(0, l));
        // D(nodei(0, l));
        // cout << g.dump() << endl;
        // D(ans);
        REP(li, l + 1) {
            // DDD(li, nodei(n - 1, li), g.shortestDistTo(nodei(n - 1, li)));
            ans = min(ans, g.shortestDistTo(nodei(n - 1, li)));
        }
        cout << ans << endl;
    }
}



Measured memory_bytes: 23660