#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <cctype>
#include <queue>
#include <deque>
#include <ctime>
#include <cstring>
#include <string>
#define _e putchar (' ')
#define _v putchar ('\n')
#define ll long long
#define INF 999999999999999999ll
#define INE -999999999999999999ll
#define File(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout)
using namespace std;
inline int lowbit (int x) {
return x&(-x);
}
inline int mx(int x,int y) {
return x>y?x:y;
}
inline int mn(int x,int y) {
return x<y?x:y;
}
inline void rd(int &x) {
int s=0,w=1;
char ch=getchar ();
while(ch<'0'||ch>'9') {if(ch=='-') w=-1; ch=getchar ();}
while(ch>='0'&&ch<='9') {s=(s<<1)+(s<<3)+(ch^48); ch=getchar ();}
x=s*w;
}
inline void wr(int x) {
if(x<0) x=-x,putchar (45);
if(x<10) {
putchar (x+48);
return ;
}
wr(x/10);
putchar (x%10+48);
}
inline int ab (int x) {
if(x<0) return -x;
return x;
}
inline void swap (int &x,int &y) {
x^=y^=x^=y;
}
const int N=5005,M=1000005;
int n,m,k,x,y,c,cnt,sum,ans,a[M],b[M],w[M],v[M],f[N][N];
int main () {
memset(f,-1,sizeof(f));
rd(n),rd(m),rd(k),rd(c);
for (int i=1;i<=n;i++) rd(a[i]);
for (int i=1;i<=n;i++) rd(b[i]);
for (int i=1;i<=m;i++) {
rd(x),rd(y);
w[i]=a[x]*a[y];
v[i]=b[x]+b[y];
sum+=v[i];
}
ans=-1;
f[0][0]=0;
for (int s=1;s<=m;s++) {
for (int i=s;i>=1;i--) {
for (int j=sum;j>=v[s];j--) {
f[j][i]=mx(f[j][i],f[j-v[s]][i-1]+w[s]);
}
}
}
for (int i=c;i<=sum;i++) ans=mx(ans,f[i][k]);
wr(ans),_v;
return 0;
}