#include <bits/stdc++.h>
using namespace std;
int n, m, w;
int comp = 0;
int peso[1000], bel[1000];
int pesoc[1000], belc[1000], c[1000], v[1000];
int pp, bb;
int g[1000][1000];
int order[1000], top;
void dfs(int a) {
  if (v[a]) return;
  v[a] = 1;
  c[a] = comp;
  pp += peso[a];
  bb += bel[a];
  for (int i = 0; i < n; i++)
    if (g[a][i]) dfs(i);
  order[--top] = a;
}
int dp[1001][1001];
int solve(int w, int i) {
  if (dp[w][i] != -1) return dp[w][i];
  if (i == n) return dp[w][i] = 0;
  int j = order[i];
  int resp = 0, l = i;
  while (l < n && c[order[l]] == c[j]) l++;
  if (pesoc[c[j]] <= w)
    resp = max(resp, belc[c[j]] + solve(w - pesoc[c[j]], l));
  for (int k = i; k < l; k++)
    if (peso[order[k]] <= w)
      resp = max(resp, bel[order[k]] + solve(w - peso[order[k]], l));
  resp = max(resp, solve(w, l));
  return dp[w][i] = resp;
}
int main() {
  int a, b;
  scanf("%d %d %d", &n, &m, &w);
  for (int i = 0; i < n; i++) scanf("%d", &peso[i]);
  for (int i = 0; i < n; i++) scanf("%d", &bel[i]);
  while (m--) {
    scanf("%d %d", &a, &b);
    a--;
    b--;
    g[a][b] = g[b][a] = 1;
  }
  top = n;
  for (int i = 0; i < n; i++)
    if (!v[i]) {
      pp = bb = 0;
      dfs(i);
      pesoc[comp] = pp;
      belc[comp++] = bb;
    }
  memset(dp, -1, sizeof dp);
  printf("%d\n", solve(w, 0));
  return 0;
}
