#include <bits/stdc++.h>
using namespace std;

struct P{
    int a, b, dist, atk;
    P(){}
    ~P(){}
    P(const P& r) : a(r.a), b(r.b), dist(r.dist), atk(r.atk) {}
    P(int a, int b, int c, int d) : a(a), b(b), dist(c), atk(d) {}
};

const int INF = 1<<29;

vector<P> G;
int dp[100][101];

void append_edge(int& a, int& b, int& c, int& d){
    G.push_back(P(a, b, c, d));
}

int N, M, L;

int main(){
    while(scanf("%d%d%d", &N, &M, &L) && (N||M||L)){
        int a, b, c, d;
        G.clear();
        for(int x = 0; x < N; x++){
            fill(dp[x], dp[x]+L+1, INF);
        }
        for(int x = 0; x < M; x++){
            scanf("%d%d%d%d", &a, &b, &c, &d);
            append_edge(--a, --b, c, d); }
        dp[0][0] = 0;
        for(int x = 0; x < N; x++){
            bool updated = false;
            for(int v = 0; v < G.size(); v++){
                int a = G[v].a, b = G[v].b,
                    dist = G[v].dist, atk = G[v].atk;
                for(int w = 0; w <= L; w++){
                    if(dp[b][w] + atk < dp[a][w]){
                        updated = true;
                        dp[a][w] = dp[b][w] + atk;
                    }
                    if(dp[a][w] + atk < dp[b][w]){
                        updated = true;
                        dp[b][w] = dp[a][w] + atk;
                    }
                    if(w >= dist){
                        if(dp[b][w-dist] < dp[a][w]){
                            updated = true;
                            dp[a][w] = dp[b][w-dist];
                        }
                        if(dp[a][w-dist] < dp[b][w]){
                            updated = true;
                            dp[b][w] = dp[a][w-dist];
                        }
                    }
                }
            }
            if(!updated) break;
        }
        int min_atk = INF;
        for(int x = 0; x <= L; x++){
            min_atk = min(min_atk, dp[N-1][x]);
        }
        printf("%d\n", min_atk);
    }
    return 0;
}