#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
  int N, M; scanf("%d%d", &N, &M);
  static int wf[20][20];
  for(int i = 0; i < N; i++)
    for(int j = 0; j < N; j++)
      wf[i][j] = 1000000000;
  for(int i = 0; i < M; i++) {
    int a,b,c,d; scanf("%d,%d,%d,%d", &a, &b, &c, &d); a--; b--;
    wf[a][b] = c;
    wf[b][a] = d;
  }
  int s,t,m1,m2; scanf("%d,%d,%d,%d", &s, &t, &m1, &m2); s--; t--;
  for(int k = 0; k < N; k++)
    for(int i = 0; i < N; i++)
      for(int j = 0; j < N; j++)
        wf[i][j] = min(wf[i][j], wf[i][k]+wf[k][j]);
  printf("%d\n", m1-m2-wf[s][t]-wf[t][s]);
  return 0;
}