package m5d17;
import java.io.BufferedInputStream;
import java.util.*;
public class 作物杂交 {
static class Node{
int x,y;
public Node() {
}
public Node(int x, int y) {
this.x = x;
this.y = y;
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
int n = sc.nextInt();
int m = sc.nextInt();
int k = sc.nextInt();
int t = sc.nextInt();
//每个品种培养时间
int val[] = new int[n+1];
//记录该种类最早合成时间
int result[] = new int[n+1];
for(int i=1;i<=n;i++){
val[i] = sc.nextInt();
}
//记录是否存在
boolean set[] = new boolean[n+1];
for(int i=1;i<=m;i++){
int x = sc.nextInt();
set[x] = true;
}
//记录每一个品种的合成路径
List list[] = new List[n+1];
for(int i=1;i<=k;i++){
int x = sc.nextInt();
int y = sc.nextInt();
int p = sc.nextInt();
if(list[p]==null){
list[p] = new ArrayList();
}
list[p].add(new Node(x,y));
}
int day = 0;
//枚举天数
while(true){
//枚举每一个品种
for(int i=1;i<=n;i++){
//如果这个品种已经存在了就不用再继续计算了
if(set[i]) continue;
//记录该品种培育所需要花费的时间
int mint = Integer.MAX_VALUE;
for (Node tmp:list[i]){
//当前枚举的杂交方法需要的两个品种都已经存在了,则可以进行计算是否能够在当前day培育出品种i
if(set[tmp.x]&&set[tmp.y]){
int time =Math.max(result[tmp.x],result[tmp.y])+Math.max(val[tmp.x],val[tmp.y]);
mint = Math.min(time,mint);
}
}
if(mint<=day){
result[i] = mint;
set[i] = true;
if(i==t){
System.out.println(mint);
return;
}
}
}
day++;
}
}
}