def show(m,a,b,c,d,x):
    for i in xrange(m):
        x[a[i]-1][b[i]-1] = c[i]
        x[b[i]-1][a[i]-1] = d[i]
    return x

def fw(n,x):
    for r in xrange(n):
        for p in xrange(n):
            for q in xrange(n):
                if x[p][q] > x[p][r] + x[r][q]:
                    x[p][q] = x[p][r] + x[r][q]
    return x

n = int(input())
m = int(input())
a = []
b = []
c = []
d = []
for i in xrange(m):
    e,f,g,h = map(int,raw_input().split(','))
    a.append(e)
    b.append(f)
    c.append(g)
    d.append(h)
x1,x2,y1,y2 = map(int,raw_input().split(','))

k = [[1000000000 for x in xrange(n)] for x in xrange(n)]
for i in xrange(n):
    for j in xrange(n):
        k[i][j] = inf
k = show(m,a,b,c,d,k)
k = fw(n,k)

ans1 = k[x1-1][x2-1]
ans2 = k[x2-1][x1-1]

print int(y1-ans1-y2-ans2)