#include <iostream>
using namespace std;
#define MAX 21
#define INF 9999999

int g[MAX][MAX],v[MAX],n,mn,minm;
bool visit[MAX];

int dijkstra(int start,int goal){
    for(int i = 0 ; i < MAX; i++){
        v[i] = INF;
        visit[i] = false;
    }
    
    v[start] = 0;
    while(true){
        minm = INF;
        for(int i = 1 ; i <= n ; i++){
            if(v[i] < minm && !visit[i]){
                minm = v[i];
                mn = i;
            }
        }
        
        if(minm == INF) break;
        visit[mn] = true;
        
        for(int j = 1 ; j <= n ; j++){
            int tmp = g[mn][j]+v[mn];
            if(tmp < v[j]) v[j] = tmp;
        }
    }

    return v[goal];
}

int main(){
    int m,a,b,c,d,x1,x2,y1,y2;
    char ch;
    
    for(int i = 1 ; i < MAX; i++)
        for(int j = 1 ; j < MAX ; j++)
            g[i][j] = INF;

    cin >> n >> m;
    while(m--){
        cin >> a >> ch >> b >> ch >> c >> ch >> d;
        g[a][b] = c;
        g[b][a] = d;
    }
    
    cin >> x1 >> ch >> x2 >> ch >> y1 >> ch >> y2;
    cout << y1 - y2 - dijkstra(x1,x2) - dijkstra(x2,x1) << endl;

    return 0;
}