#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
#include<cassert>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)


int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int d[21][21]; rep(i, 21) rep(j, 21) d[i][j] = inf;
    int N;
    cin >> N;
    int m; cin >> m;
    char ch;
    rep(i, m) {
        int a, b, c, dd; cin >> a >> ch >> b >> ch >> c >> ch >> dd;
        a--; b--;
        d[a][b] = c;
        d[b][a] = dd;
    }
    rep(k, N) rep(i, N) rep(j, N) {
        if (d[i][k] + d[k][j] < d[i][j]) d[i][j] = d[i][k] + d[k][j];
    }
    int s, g, v, p; cin >> s >> ch >> g >> ch >> v >> ch >> p; s--; g--;
    cout << v - p - (d[s][g] + d[g][s]) << endl;
}

