#include <bits/stdc++.h>
using namespace std;
int wt[1010], bu[1010];
long long save[1010][1010];
vector<int> vc[1010], grp[1010];
bool visit[1010];
void dfs(int u, int k) {
  grp[k].push_back(u);
  visit[u] = 1;
  for (int i = 0; i < vc[u].size(); i++) {
    int z = vc[u][i];
    if (!visit[z]) dfs(z, k);
  }
}
int k;
long long dp(int p, int w) {
  long long& ret = save[p][w];
  if (ret != -1) return ret;
  if (p == k) return 0;
  long long r = 0, totw = 0, totb = 0;
  r = max(r, dp(p + 1, w));
  for (int i = 0; i < grp[p].size(); i++) {
    int z = grp[p][i];
    totw += wt[z];
    totb += bu[z];
    if (wt[z] <= w) r = max(r, bu[z] + dp(p + 1, w - wt[z]));
  }
  if (totw <= w) r = max(r, totb + dp(p + 1, w - totw));
  return ret = r;
}
int main() {
  int n, m, w, i, u, v;
  scanf("%d %d %d", &n, &m, &w);
  for (i = 1; i <= n; i++) scanf("%d", &wt[i]);
  for (i = 1; i <= n; i++) scanf("%d", &bu[i]);
  while (m--) {
    scanf("%d %d", &u, &v);
    vc[u].push_back(v);
    vc[v].push_back(u);
  }
  k = 1;
  for (i = 1; i <= n; i++) {
    if (!visit[i]) {
      dfs(i, k);
      k++;
    }
  }
  memset(save, -1, sizeof save);
  printf("%I64d\n", dp(1, w));
}
