/*

*/
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>
#include<deque>
#include<queue>

using std::cout;
using std::cin;
using std::setw;
using std::setfill;
using std::string;
using std::pair;
using std::make_pair;
using std::vector;
using std::queue;
using std::deque;
using std::priority_queue;
using std::next_permutation;
//using std::iota;
using std::sort;
using std::greater;
using std::max;
using std::min;

#define INF 99999;
#define MOD 1000000007

#define EVEL 1

#ifndef EVEL
#define dbug(X) std::cout << #X << ":" <<X<<" " ;
#define dbugf(s) std::cout << s << " ";
#define dbugln std::cout<<"\n";
#else
#define dbug(X) {}
#define dbugf(s) {}
#define dbugln {}
#endif

int n, m;
char com;
//vector< vector< pair<int, int> > > graph;
int Cost[25][25];
int s, g, V, P;

int main(){
	cin.tie(0);
	std::ios::sync_with_stdio(false);

    cin >> n >> m;
    //graph.resize(n);
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            Cost[i][j] = INF;
        }
    }
    int a, b, c, d;
    for(int i = 0; i < m; i++){
        cin >> a >>com>> b >>com>> c >>com>> d;
        Cost[a][b] = c;
        Cost[b][a] = d;
    }
    cin >> s >>com>> g >>com>> V >>com>> P;

    for(int k = 1; k <= n; k++){
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= n; j++){
                dbugf(k)dbugf(i)dbugf(j)dbug(Cost[i][j])dbugln
                Cost[i][j] = min(Cost[i][j], Cost[i][k] + Cost[k][j]);
                dbug(Cost[i][j])dbug(Cost[i][k])dbug(Cost[k][j])dbugln
            }
        }
        dbugln;
    }

    cout << V - Cost[s][g] - Cost[g][s] - P << "\n";

    return 0;
}
