#include<bits/stdc++.h>
using namespace std;
const int INF=1001001001;
struct edge{
    int to,cost,num;
    edge(int to,int cost,int num)
        :to(to),cost(cost),num(num){}
};

struct data{
    int pos,cost,money;
    data(int pos,int cost,int money)
        :pos(pos),cost(cost),money(money){}

    bool operator<(const data &d)const{
        return cost>d.cost;
    }
};

int N,M,L;
vector<edge>G[100];
int dist[100][101];

void solve(){
    fill_n(*dist,100*101,INF);
    dist[0][L]=0;
    priority_queue<data>que;
    que.push(data(0,0,L));

    while(que.size()){
        data d=que.top();que.pop();
        if(dist[d.pos][d.money]<d.cost)continue;
        for(int i=0;i<G[d.pos].size();i++){
            edge &e=G[d.pos][i];
            if(dist[e.to][d.money]>d.cost+e.num){
                dist[e.to][d.money]=d.cost+e.num;
                que.push(data(e.to,dist[e.to][d.money],d.money));
            }
            if(e.cost<=d.money&&dist[e.to][d.money-e.cost]>d.cost){
                dist[e.to][d.money-e.cost]=d.cost;
                que.push(data(e.to,dist[e.to][d.money-e.cost],d.money-e.cost));
            }
        }
    }

    int mi=INF;
    for(int i=0;i<=L;i++)mi=min(mi,dist[N-1][i]);
    cout<<mi<<endl;
}

int main(){
    while(cin>>N>>M>>L,N||M||L){
        fill_n(G,100,vector<edge>());
        for(int i=0;i<M;i++){
            int a,b,c,d;
            cin>>a>>b>>c>>d;a--;b--;
            G[a].push_back(edge(b,c,d));
            G[b].push_back(edge(a,c,d));
        }
        solve();
    }
    return 0;
}