#include<bits/stdc++.h>
#define MAX_V 20
using namespace std;

struct edge { 
  int to, cost;
  edge(){}
  edge(int to,int cost):to(to),cost(cost){};
};
typedef pair<int ,int> P;
const int INF = 1 << 30;
int V; //ノードの数
vector<edge> Graph[MAX_V];
int min_cost[MAX_V];

void Dijkstra(int s){ // s:スタートからの最小コストをmin_costに設定
  priority_queue<P,vector< P >, greater<P> > que;
  fill(min_cost,min_cost + V,INF);
  min_cost[s] = 0;
  que.push(P(0,s));
  
  while(!que.empty()){
    P p = que.top();que.pop();
    int now = p.second;
    int cost = p.first;
    if(min_cost[now] < cost) continue;
    
    for(int i = 0; i < Graph[now].size(); i++){
      edge e = Graph[now][i];
      if(min_cost[e.to] > min_cost[now] + e.cost){
	min_cost[e.to] = min_cost[now] + e.cost;
	que.push(P(min_cost[e.to], e.to));
      }
    }
  }
}

int main(){
  int m;
  cin>>V;
  cin>>m;
  int ans;
  for(int i=0;i<m;i++){
    int a,b,c,d;
    char ch;
    cin>>a>>ch>>b>>ch>>c>>ch>>d;
    a--;b--;
    Graph[a].push_back(edge(b,c));
    Graph[b].push_back(edge(a,d));
  }
  int s1,s2,money,cst;
  char ch;

  cin>>s1>>ch>>s2>>ch>>money>>ch>>cst;
  s1--;s2--;
  ans = money - cst;
  
  Dijkstra(s1);
  ans -= min_cost[s2];
  Dijkstra(s2);
  ans -= min_cost[s1];
  
  cout << ans << endl;
}
  