#include <cstdio>
#include <queue>
using namespace std;

class State
{
public:
  int pos, money, danger;

  State(int p, int m, int d)
    :pos(p), money(m), danger(d) {}

  bool operator < (const State& st) const
  {
    return this->danger > st.danger;
  }
};

int main()
{
  const int INF = 1 << 30;
  const int MAX_N = 100;
  const int MAX_L = 101;

  int N, M, L;
  int cost[MAX_N][MAX_L];
  bool visited[MAX_N][MAX_L];
  pair<int, int> edge[MAX_N][MAX_N];

  while (scanf("%d %d %d", &N, &M, &L) != EOF) {
    if (N == 0 && M == 0 && L == 0)
      break;

    for (int i = 0; i < MAX_N; ++i) {
      for (int j = 0; j < MAX_N; ++j)
	edge[i][j].first = edge[i][j].second = INF;
    }

    for (int i = 0; i < MAX_N; ++i) {
      for (int j = 0; j < MAX_L; ++j) {
	cost[i][j] = INF;
	visited[i][j] = false;
      }
    }

    for (int i = 0; i < M; ++i) {
      int A, B, D, E;
      scanf("%d %d %d %d", &A, &B, &D, &E);
      --A;
      --B;
      edge[A][B].first = edge[B][A].first = D;
      edge[A][B].second = edge[B][A].second = E;
    }

    priority_queue<State> que;
    cost[0][L] = 0;
    que.push(State(0, L, 0));

    while (!que.empty()) {
      State st = que.top();
      que.pop();

      if (st.pos == N-1) {
	printf("%d\n", st.danger);
	break;
      }

      if (cost[st.pos][st.money] < st.danger || visited[st.pos][st.money])
	continue;

      visited[st.pos][st.money] = true;
      for (int i = 0; i < N; ++i) {
	if (edge[st.pos][i].first == INF)
	  continue;

	if (st.money >= edge[st.pos][i].first) {
	  int m = st.money - edge[st.pos][i].first;
	  if (st.danger < cost[i][m]) {
	    cost[i][m] = st.danger;
	    que.push(State(i, m, st.danger));
	  }
	}

	int d = st.danger + edge[st.pos][i].second;
	if (d < cost[i][st.money]) {
	  cost[i][st.money] = d;
	  que.push(State(i, st.money, d));
	}
      }

    }

  }
  return 0;
}