#include <iostream>
#include <sstream>
#include <algorithm>
#define INF 1<<27
using namespace std;
int V,E;
int cost[301][301];
bool used[301];
int d[301];

void init(){
  fill(d,d + 101,INF);
  fill(used,used + 101,false);
}

void dijkstra(int s){
  init(); 
  d[s] = 0;
  while(1){
    int v = -1;
    for(int i = 1 ; i < V ; i++ ){
      if(!used[i] && (v == -1 || d[v] > d[i]))v = i;
    }
    if(v == -1)break;
    used[v] = true;

    for(int i = 1 ; i < V ; i++ ){
      d[i] = min(d[i],d[v] + cost[v][i]);
    }
  }
}

int main(){
  cin >> V >> E;
  V++;
  fill(cost[0],cost[101],INF);
  for(int i = 0 ; i < E ; i++ ){
    int a,b,c,d;
    char ch;
    cin >> a >>ch>> b >>ch>> c >>ch>> d;
	cost[a][b] = c;
	cost[b][a] = d;
  }
 
  int s,g,c1,c2;
  char ch;
  cin >> s >>ch>> g >>ch>> c1 >>ch>> c2;

  dijkstra(s);
  int st = d[g];


  dijkstra(g);
  int go = d[s];
  cout << c1-(st + go + c2) << endl; 
}