#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <limits>
#include <cfloat>
#include <functional>
using namespace std;

template <class T>
class Edge
{
public:
    int to;
    T cost;
    Edge(){};
    Edge(int to0, T cost0){to = to0; cost = cost0;}
};

template<class T>
void shortestPath(const vector<vector<Edge<T> > >& edges, int start, vector<T>& dist)
{
    const T INF = numeric_limits<T>::max();
    const T EPS = static_cast<T>(1.0e-10);

    dist.assign(edges.size(), INF);
    dist[start] = 0;
    priority_queue<pair<T,int>, vector<pair<T,int> >, greater<pair<T,int> > > q;
    q.push(make_pair(0, start));

    while(!q.empty()){
        pair<T, int> p = q.top();
        q.pop();
        int v = p.second;
        if(dist[v] < p.first - EPS)
            continue;
        for(unsigned i=0; i<edges[v].size(); ++i){
            Edge<T> e = edges[v][i];
            if(dist[v] + e.cost < dist[e.to] - EPS){
                dist[e.to] = dist[v] + e.cost;
                q.push(make_pair(dist[e.to], e.to));
            }
        }
    }
}

int main()
{
    int n, m;
    cin >> n >> m;

    vector<vector<Edge<int> > > edges(n);
    for(int i=0; i<m; ++i){
        int a, b, c, d;
        char z;
        cin >> a >> z >> b >> z >> c >> z >> d;
        edges[a-1].push_back(Edge<int>(b-1, c));
        edges[b-1].push_back(Edge<int>(a-1, d));
    }

    int x1, x2, y1, y2;
    char z;
    cin >> x1 >> z >> x2 >> z >> y1 >> z >> y2;

    vector<int> dist1, dist2;
    shortestPath(edges, x1-1, dist1);
    shortestPath(edges, x2-1, dist2);

    int ret = y1 - y2 - dist1[x2-1] - dist2[x1-1];
    cout << ret << endl;
}