#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>
#include <stack>
#include <set>
#include <vector>

using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INF = 987654321;
const double EPS = 1e-10;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
    return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
    os<<'[';
    rep(i,a.size()) os<<(i?" ":"")<<a[i];
    return os<<']';
}

ll G[20][20];
ll dp[20][20];
int V;

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


int main() {
    int n; cin >> n;
    int m; cin >> m;
    char comma;
    rep(i, m) {
        int a, b, c, d; cin >> a >> comma >> b >> comma >> c >> comma >> d;
        G[a - 1][b - 1] = c;
        G[b - 1][a - 1] = d;
    }
    int x1, x2, y1, y2; cin >> x1 >> comma >> x2 >> comma >> y1 >> comma >> y2;

    V = n;
    rep(i, n) rep(j, n) dp[i][j] = INF;
    rep(i, n) rep(j, n) if (G[i][j] != 0) dp[i][j] = G[i][j];

    warshall_floyd();
    cout << y1 - dp[x1 - 1][x2 - 1] - dp[x2 - 1][x1 - 1] - y2 << endl;

    return 0;
}