Max = 1000000

def dijkstraDG graph, start
  #初期化
  dist = Array.new(graph.size, Max)
  visited = Array.new(graph.size, false)
  dist[start] = 0
  
  loop do
    #未訪問節点でコスト最少の点を決定
    u = -1
    sd = Max
    (0...graph.size).each do |i|
        if ! visited[i] && dist[i] < sd
          sd = dist[i]
          u = i
      end
    end
    break if u == -1
    
    #未訪問節点から隣接節点へのコストが最少であれば更新する
    visited[u] = true
    graph[u].each do |p|
      v = p[0]
      w = p[1]
      newLength = dist[u] + w
      if(newLength < dist[v])
        dist[v] = newLength
      end
    end
  end
  dist
end

n = $stdin.gets.to_i
m = $stdin.gets.to_i

Graph = Array.new(n).map{Array.new}

m.times do |t|
  a,b,c,d = $stdin.gets.chomp.split(",").map(&:to_i)
  Graph[a - 1] << [b - 1,c]
  Graph[b - 1] << [a - 1,d]
end

start, dest, money, price = $stdin.gets.chomp.split(",").map(&:to_i)

outward = dijkstraDG(Graph, start - 1)
homeward = dijkstraDG(Graph, dest - 1)
p money - price - outward[dest - 1] - homeward[start - 1]