#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
struct edge { int to, cost; };
vector<edge> G[21];
int search(int start, int goal)
{
    //first := cost, second := now vertex
    priority_queue<P, vector<P>, greater<P>> que;
    vector<int> dist(21, INF);
    que.push(P(0, start));
    dist[start] = 0;
    while(not que.empty())
    {
        P now = que.top(); que.pop();
        if(now.second == goal) break;
        for(int u = 0; u < G[now.second].size(); u++)
        {
            edge e = G[now.second][u];
            if(now.first + e.cost < dist[e.to])
            {
                dist[e.to] = now.first + e.cost;
                que.push(P(dist[e.to], e.to));
            }
        }
    }
    return dist[goal];
}
int main()
{
    int n, m; cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        int a, b, c, d;
        scanf("%d,%d,%d,%d", &a, &b, &c, &d);
        G[a].push_back({b, c});
        G[b].push_back({a, d});
    }
    int start, goal, v, p;
    scanf("%d,%d,%d,%d", &start, &goal, &v, &p);
    int ans = v - p;
    int a = search(start, goal);
    int b = search(goal, start);
    cout << ans - a - b << endl;
    return 0;
}


