#include <iostream>
#include <string>
#include <cstdio>

int main()
{
    const int MAXTOWN = 20;

    int number_town;//????????????
    int number_way;//????????°
    int min_cost[MAXTOWN + 1][MAXTOWN + 1];//i????????????j??????????§?????????????????????????????????????????´?

    for (int i = 0; i <= MAXTOWN; i++) {
        for (int j = 0; j <= MAXTOWN; j++) {
            min_cost[i][j] = 999999;//??¨????????§???????????§????????????
        }
    }

    std::cin >> number_town;//????????°????????±???????????????
    std::cin >> number_way;//????????°????????±???????????????

    for (int way = 0; way < number_way; way++) {//??????????????????????§??????????????????????????????????
        int from_way, to_way, cost, back_cost;
        scanf("%d, %d, %d, %d", &from_way, &to_way, &cost, &back_cost);

        min_cost[from_way][to_way] = cost;
        min_cost[to_way][from_way] = back_cost;
    }   

    for (int medium_town = 1; medium_town <= number_town; medium_town++) {//??????????????±????????????????????????????????????????????§?????????
        for (int start_town = 1; start_town <= number_town; start_town++) {
            for (int end_town = 1; end_town <= number_town; end_town++) {
                int start_medium_end_long = min_cost[start_town][medium_town] + min_cost[medium_town][end_town];
                if (min_cost[start_town][end_town] > start_medium_end_long) {//??????????????±????????????????????´???
                    min_cost[start_town][end_town] = start_medium_end_long;
                }   
            }
        }
    }

    int start_town, end_town;
    int get_money, lost_money;
    scanf("%d, %d, %d, %d", &start_town, &end_town, &get_money, &lost_money);//????????????????????????????????????????????????
    int profit;
    //?????????????????\?????£????????????????????????
    profit = get_money - lost_money - min_cost[start_town][end_town] - min_cost[end_town][start_town];

    std::cout << profit << std::endl;
    return 0;
}