INF = 1<<29
def dijkstra(n, l, pos, route, cost_e, cost_d)
  q = []
  q << [pos, l, 0]
  e_min = [INF]*(n+1)
  e_min[pos] = 0
  until q.empty?
    p = q.min{ |x, y| e_min[x[0]] <=> e_min[y[0]] }
    q.delete(p)
    s, r, e = p
    route[s].each do |t|
      enemy = e + cost_e[s][t] 
      if e_min[t] > e
        e_min[t] = enemy if e_min[t] > enemy
        if r >= cost_d[s][t]
          q << [t, r - cost_d[s][t], e]
          e_min[t] = e
        end
        q << [t, r, enemy]
      end
    end
  end
  e_min[n]
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_e[s][t] = cost_e[t][s] = e
    cost_d[s][t] = cost_d[t][s] = d
  end
  p dijkstra(n, l, 1, route, cost_e, cost_d)
end