#include<stdio.h>
#include<string.h>

#include<limits.h>


int min( int a ,int b )
{
	return a > b ? b : a ;
}


void in( int move[][ 200 ] ,int next[][ 200 ] ,int *ans ,int m )
{
	int now ,nex ;
	int go ,back ;

	int i ,j ;
	for( i = 0 ; i < m ; ++i )
	{
		scanf( "%d,%d,%d,%d" ,&now ,&nex ,&go ,&back ) ;


		++next[ now ][ 0 ] ;
		++next[ nex ][ 0 ] ;

		next[ now ][ next[ now ][ 0 ] ] =	nex ;
		next[ nex ][ next[ nex ][ 0 ] ] =	now ;


		move[ now ][ nex ] = go ;
		move[ nex ][ now ] = back ;
/*
		go_k[ now ][ nex ] = go ;

		back_k[ nex ][ now ] = back ;
*/
	}
}


int next[ 200 ][ 200 ] ;

int move[ 200 ][ 200 ] ;

bool came[ 200 ][ 200 ] ;


int n ,m ;

int st ,end ;

void search( int *ans ,int kale[][ 200 ] ,int now )
{
	int i ;
	for( i = 1 ; i <= next[ now ][ 0 ] ; ++i )
	{
		if( next[ now ][ i ] != st && came[ now ][ i ] == false )
		{
			came[ now ][ i ] = true ;

			ans[ next[ now ][ i ] ] = min( ans[ now ] + kale[ now ][ next[ now ][ i ] ] ,ans[ next[ now ][ i ] ] ) ;
		
			if( next[ now ][ i ] != end )
			{
				search( ans ,kale ,next[ now ][ i ] ) ;
			}
		}
	}
}


void init( int *ans ,int n )
{
	while( n )
	{
		ans[ n-- ] = INT_MAX ;
	}
}
	


int main()
{
	int kale ,stick ;

	int ans[ 20 + 1 ] ;


	scanf( "%d" ,&n ) ;

	init( ans ,n ) ;


	scanf( "%d" ,&m ) ;

	in( move ,next ,ans ,m ) ;


	scanf( "%d,%d,%d,%d" ,&st ,&end ,&kale ,&stick ) ;

	ans[ st ] = 0 ;
	
	search( ans ,move ,st ) ;

	stick += ans[ end ] ;

	init( ans ,n ) ;


	st += end ;
	end = st - end ;
	st -= end ;


	ans[ st ] = 0 ;

	memset( came ,0 ,sizeof came ) ;

	search( ans ,move ,st ) ;


	printf( "%d\n" ,kale - ( stick + ans[ end ] ) ) ;


	return 0 ;
}