#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> dist(n,vector<int>(n,INF));
    rep(i,n) dist[i][i] = 0;
    rep(i,m){
        int a,b,c,d;
        scanf("%d,%d,%d,%d",&a,&b,&c,&d);
        --a;--b;
        dist[a][b] = c;
        dist[b][a] = d;
    }
    
    rep(k,n)rep(i,n)rep(j,n) dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j]);
    
    int s,g,v,p;
    scanf("%d,%d,%d,%d",&s,&g,&v,&p);
    --s;--g;
    cout << (v - dist[s][g] - dist[g][s] - p) << endl;
    return 0;
}
