def dijkstra(n, l, pos, route, cost_e, cost_d)
  visit = (n+1).times.map{ [0] * (n+1) }
  done = (n+1).times.map{ [false] * (l+1) }
  q = []
  q << [pos, l, 0]
  until q.empty?
    p = q.min{ |x, y| x[2] <=> y[2] }
    q.delete(p)
    s, r, e = p
    return e if s == n
    next if done[s][r]
    done[s][r] = true
    route[s].each do |t|
      next if visit[s][t] >= 2
      visit[s][t] += 1
      q << [t, r, e + cost_e[s][t]]
      if r >= cost_d[s][t]
        q << [t, r - cost_d[s][t], e]
      end
    end
  end
end
loop do
  n, m, l = gets.split.map(&:to_i)
  break if n == 0
  route = (n+1).times.map{ [] }
  cost_d = (n+1).times.map{ [0] * (n+1) }
  cost_e = (n+1).times.map{ [0] * (n+1) }
  m.times.map do
    s, t, d, e = gets.split.map(&:to_i)
    route[s] << t
    route[t] << s
    cost_d[s][t] = cost_d[t][s] = d
    cost_e[s][t] = cost_e[t][s] = e
  end
  p dijkstra(n, l, 1, route, cost_e, cost_d)
end