n = gets.to_i
m = gets.to_i
es = []
m.times do
  a, b, c, d = gets.split(?,).map(&:to_i)
  es << [a-1, b-1, c]
  es << [b-1, a-1, d]
end
s, g, v, p = gets.split(?,).map(&:to_i)
s, g = s-1, g-1
bf = lambda do |s, g|
  cs = Array.new n
  cs[s] = 0
  (n-1).times do
    es.each do |a, b, c|
      if cs[a] && (!cs[b] || cs[a] + c < cs[b])
        cs[b] = cs[a] + c
      end
    end
  end
  cs[g]
end
p v - (p + bf[s, g] + bf[g, s])