#include<cstdio>
#include<iostream>
#include<queue>
#include<algorithm>
#include<climits>
const int MAXN = 22;
const int INF = INT_MAX/3;
int graph[MAXN][MAXN];

using namespace std;

void dijkstra(int s,int* d,int n){
  bool visited[MAXN];
  fill(visited, visited+n+1,false);
  fill(d, d+n+1, INF);
  d[s] = 0;
  while(true){
    int minv  = -1;
    for(int i = 1;i <= n;i++){
      if((not visited[i]) and (d[i] < d[minv] or minv == -1)) minv = i;
    }
    if(minv == -1)break;
    visited[minv] = true;
    for(int i = 1;i <= n;i++){
      d[i] = min(d[i],graph[minv][i] + d[minv]);
    }
  }
}

int main(){
  int n ,m;
  scanf("%d",&n);
  scanf("%d",&m);
  //cin >> n;
  //cin >> m;
  fill(*graph,*(graph+MAXN),INF);
  for(int i = 0;i < m;i++){
    int a,b,c,d;
    scanf("%d,%d,%d,%d",&a,&b,&c,&d);
    //cin >> a >> b >> c >> d;
    graph[a][b] = c;
    graph[b][a] = d;
  }
  int x1,x2,y1,y2;
  scanf("%d,%d,%d,%d",&x1,&x2,&y1,&y2);
  int d[MAXN];
  dijkstra(x1,d,n);
  int min1 = d[x2];
  dijkstra(x2,d,n);
  int min2 = d[x1];
  cout << y1 - y2 - min1 - min2 << endl;
}