#include<bits/stdc++.h>
using namespace std;

int mini[21][21];
const int Inf = 1e5;

int main(){

    int n,m;
    cin >> n >> m;

    for(int i=0;i<=n;++i){
        for(int j=0;j<=n;++j){
            if(i == j)mini[i][j] = 0;
            else mini[i][j] = Inf;
        }
    }

    for(int i=0;i<m;++i){
        int a,b,c,d;
        scanf("%d,%d,%d,%d",&a,&b,&c,&d);
        mini[a][b] = c;
        mini[b][a] = d;
    }

    int s,g,v,p;
    scanf("%d,%d,%d,%d",&s,&g,&v,&p);

    for(int k=1;k<=n;++k){
        for(int i=1;i<=n;++i){
            for(int j=1;j<=n;++j){
                mini[i][j] = min(mini[i][j],mini[i][k]+mini[k][j]);
            }
        }
    }

    cout << v - (p+mini[s][g]+mini[g][s]) << endl;

    return 0;
}
