#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1005, MAXM = MAXN * MAXN;
int tot, Last[MAXN], Next[MAXM], Go[MAXM];
int n, m, ww, w[MAXN], b[MAXN], ord[MAXN], num, p[MAXN][MAXN][2], W[MAXN],
    B[MAXN], cnt[MAXN], f[MAXN][MAXN];
bool flag[MAXN];
void link(int u, int v) { Next[++tot] = Last[u], Last[u] = tot, Go[tot] = v; }
void dfs(int now) {
  if (flag[now]) return;
  flag[now] = 1, ord[now] = num;
  for (int p = Last[now]; p; p = Next[p]) dfs(Go[p]);
}
int main() {
  scanf("%d%d%d", &n, &m, &ww);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    link(u, v), link(v, u);
  }
  for (int i = 1; i <= n; i++) {
    if (flag[i]) continue;
    ++num;
    dfs(i);
  }
  for (int i = 1; i <= n; i++) {
    int t = ord[i];
    cnt[t]++;
    p[t][cnt[t]][0] = w[i];
    p[t][cnt[t]][1] = b[i];
    W[t] += w[i];
    B[t] += b[i];
  }
  for (int i = 1; i <= num; i++) {
    p[i][++cnt[i]][0] = W[i];
    p[i][cnt[i]][1] = B[i];
  }
  memset(f, 200, sizeof f);
  f[0][0] = 0;
  for (int i = 1; i <= num; i++) {
    for (int j = 0; j <= ww; j++) {
      f[i][j] = max(f[i][j], f[i - 1][j]);
      for (int k = 1; k <= cnt[i]; k++) {
        if (j + p[i][k][0] <= ww) {
          f[i][j + p[i][k][0]] =
              max(f[i][j + p[i][k][0]], f[i - 1][j] + p[i][k][1]);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= ww; i++) ans = max(ans, f[num][i]);
  printf("%d\n", ans);
}
