#include<cstdio>
#include<vector>
#include<queue>
#include<memory.h>
#include<limits.h>
using namespace std;
typedef long long lld;
struct info {
int next;
lld cost;
info(int inext, lld icost) :next(inext), cost(icost) {}
};
typedef vector<info> edge_info;
const int MAX_NODE = 111;
const lld MINUS_INF = LLONG_MIN;
edge_info edges[MAX_NODE];
lld city[MAX_NODE];
lld earn[MAX_NODE];
int main() {
int n, s, e, m;
scanf("%d%d%d%d", &n, &s, &e, &m);
for (int i = 0; i < m; i++) {
int u, v;
lld w;
scanf("%d%d%lld", &u, &v, &w);
edges[u].push_back(info(v, w));
}
for (int i = 0; i < n; i++) {
scanf("%lld", &earn[i]);
} // input end
vector<int> visited_node;
visited_node.push_back(s);
int visit[MAX_NODE];
memset(visit, 0, sizeof(visit));
queue<int> Q;
Q.push(s);
visit[s] = 1;
while (!Q.empty()) {
int here = Q.front();
Q.pop();
for (auto edge : edges[here]) {
int there = edge.next;
if (visit[there]) continue;
visit[there] = true;
Q.push(there);
visited_node.push_back(there);
}
} // 1. Create visited node sequence
if (!visit[e]) {
puts("gg");
return 0;
} // 2. result condition : impossible
for (int i = 0; i < n; i++) city[i] = MINUS_INF; // init
city[s] = earn[s];
bool updated;
int negative_cycle_node;
memset(visit, 0, sizeof(visit));
for (int iter = 0; iter < n; iter++) {
updated = false;
for (int here = 0; here < n; here++) {
if (city[here] == MINUS_INF) continue;
for (auto edge : edges[here]) {
int there = edge.next;
lld tcost = -edge.cost + city[here] + earn[there];
if (city[there] < tcost) {
city[there] = tcost;
updated = true;
if (iter == n - 1) {
Q.push(there);
visit[there] = 1;
}
}
}
}
if (!updated) break;
}
if (updated) {
while (!Q.empty()){
int here = Q.front();
Q.pop();
for (auto edge : edges[here]) {
if (visit[edge.next]) continue;
visit[edge.next] = 1;
Q.push(edge.next);
}
}
}
if (updated && visit[e]) puts("Gee");
else printf("%lld\n", city[e]);
return 0;
}
// 16% WA
/*
4 0 1 4
0 1 3
0 2 0
2 3 0
3 2 0
0 0 0 1
*/
// 17% WA