#include <iostream>
#include <sstream>
#include <fstream>

#include <ctime>
#include <cstdlib>
#include <cstring>
#include <cctype>

#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>

using namespace std;

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){
    os << "{ ";
    for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
        os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", ");
    os << " }";
    return os;
}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
#define vv(type,w,h,init) vector<vector<type>>(h,vector<type>(w,init))
typedef vector<string> vs;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long ul;
typedef unsigned long long ull;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define pb push_back
#define mp make_pair

string const resstr[] = {"Impossible","Possible","No","Yes"};

const int MAX_V = 100;

int cost[MAX_V][MAX_V];

int V;

void bm(){
    rep(k,V)rep(i,V)rep(j,V){
        cost[i][j] = min(cost[i][j], cost[i][k]+cost[k][j]);
    }

    // rep(i,V)rep(j,V){
    //     // printf("%d -> %d %d\n", i,j, cost[i][j]);
    // }
}

int main(){
    rep(i,100)rep(j,100){
        cost[i][j]=1<<29;
    }
    rep(i,100) cost[i][i]=0;

    int E;
    cin >> V >> E;
    rep(i,E){
        int a,b,c,d;
        scanf("%d,%d,%d,%d",&a,&b,&c,&d);
        a--,b--;
        cost[a][b]=c, cost[b][a]=d;
    }

    bm();
    int x1,x2,y1,y2; 
    scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
    x1--, x2--;

    int dis = cost[x1][x2] + cost[x2][x1];
    // cout << cost[x1][x2] << " " <<  cost[x2][x1] << endl;
    cout << y1 - y2 - dis << endl;
}