import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
static int cityCnt, start, end, tranportCnt;
static int[] incomeOfCity;
static Edge[] edgeList;
static long[] maxIncome;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
cityCnt = Integer.parseInt(st.nextToken());
start = Integer.parseInt(st.nextToken());
end = Integer.parseInt(st.nextToken());
tranportCnt = Integer.parseInt(st.nextToken());
maxIncome = new long[cityCnt];
Arrays.fill(maxIncome, Long.MIN_VALUE);
edgeList = new Edge[tranportCnt];
for (int i = 0; i < tranportCnt; i++) {
st = new StringTokenizer(br.readLine());
int s = Integer.parseInt(st.nextToken());
int e = Integer.parseInt(st.nextToken());
int fee = Integer.parseInt(st.nextToken());
edgeList[i] = new Edge(s, e, fee);
}
incomeOfCity = new int[cityCnt];
st = new StringTokenizer(br.readLine());
for (int i = 0; i < cityCnt; i++) {
incomeOfCity[i] = Integer.parseInt(st.nextToken());
}
// 알고리즘 수행
maxIncome[start] = incomeOfCity[start];
for (int i = 0; i < cityCnt + 100; i++) {
for (int j = 0; j < tranportCnt; j++) {
Edge now = edgeList[j];
int s = now.s;
int e = now.e;
int fee = now.fee;
if (maxIncome[s] == Long.MIN_VALUE)
continue;
else if (maxIncome[s] == Long.MAX_VALUE)
maxIncome[e] = Long.MAX_VALUE;
else if (maxIncome[e] < maxIncome[s] + incomeOfCity[e] - fee) {
maxIncome[e] = maxIncome[s] + incomeOfCity[e] - fee;
if (i >= cityCnt - 1)
maxIncome[e] = Long.MAX_VALUE;
}
}
}
if (maxIncome[end] == Long.MIN_VALUE)
System.out.println("gg");
else if (maxIncome[end] == Long.MAX_VALUE)
System.out.println("Gee");
else
System.out.println(maxIncome[end]);
}
}
class Edge {
int s;
int e;
int fee;
public Edge(int s, int e, int fee) {
this.s = s;
this.e = e;
this.fee = fee;
}
}