def dijkstra s, g
	current, cost, close, open = s, 0, {s=>0}, {}
	while true
		@arr[current].each{|to, c| open[to] = cost + c if !close[to] && (!open[to] || open[to] > cost + c)}
		min = nil
		open.to_a.each{|to, c| min = [to, c] if min.nil? || min[1] > c}
		current, cost = min
		open.delete(current)
		close[current] = cost
        break if current == g
	end
	close[g]
end

n = gets.to_i
m = gets.to_i
@arr = Array.new(n + 1){[]}
m.times{
    a, b, c, d = gets.chomp.split(',').map(&:to_i)
    @arr[a] << [b, c]
    @arr[b] << [a, d]
}
s, g, v, p = gets.chomp.split(',').map(&:to_i)
puts v - p - dijkstra(s, g) - dijkstra(g, s)

