#include<bits/stdc++.h>
using namespace std;
struct State{
    int num,cost;
    bool operator < (const State &obj)const{
        if(cost != obj.cost) return cost > obj.cost;
        return false;
    }
};
int mini[21];

int main(){
    int n,m;
    scanf("%d",&n);
    vector<State> costs[n+1];
    scanf("%d",&m);
    for(int i=0;i<m;++i){
        int a,b,c,d;
        scanf("%d,%d,%d,%d",&a,&b,&c,&d);
        costs[a].push_back((State){b,c});
        costs[b].push_back((State){a,d});
    }
    int s,g,v,p;
    scanf("%d,%d,%d,%d",&s,&g,&v,&p);
    int wayToG, wayToS;
    for(int j=0;j<2;++j){
        for(int i=0;i<=n;++i)mini[i]=INT_MAX;
        priority_queue<State> Q;
        if(j==0){
            mini[s] = 0;
            Q.push((State){s,0});
        }
        else{
            mini[g] = 0;
            Q.push((State){g,0});
        }
        while(!Q.empty()){
            State now = Q.top();
            Q.pop();
            int oldNum = now.num, oldCost = now.cost;
            if(j == 0 && oldNum == g){
                wayToG = oldCost;
                break;
            }
            else if(j == 1 && oldNum == s){
                wayToS = oldCost;
                break;
            }
            for(int i=0;i<costs[oldNum].size();++i){
                int newNum = costs[oldNum][i].num;
                int newCost = oldCost + costs[oldNum][i].cost;
                if(newCost < mini[newNum]){
                    mini[newNum] = newCost;
                    Q.push((State){newNum,newCost});
                }
            }
        }
    }
    printf("%d\n",v-(p+wayToS+wayToG));

    return 0;
}