n = gets.to_i

m = gets.to_i
roads = (1..m).map {
    i, j, c1, c2 = gets.split(",").map(&:to_i)
    [i-1, j-1, c1, c2] 
}

s, t, given, price = gets.split(",").map(&:to_i)
s -= 1
t -= 1

cost = [Float::INFINITY] * n 
cost[s] = 0 
(n-1).times {
    roads.each{|i, j, c1, c2|
        cost[j] = [cost[j], cost[i] + c1].min
        cost[i] = [cost[i], cost[j] + c2].min
    }   
}
outward_cost = cost[t]

cost = [Float::INFINITY] * n 
cost[t] = 0 
(n-1).times {
    roads.each{|i, j, c1, c2|
        cost[j] = [cost[j], cost[i] + c1].min
        cost[i] = [cost[i], cost[j] + c2].min
    }   
}
homeward_cost = cost[s]

p given - outward_cost - price - homeward_cost