#include <bits/stdc++.h>
int N, M, W, f[1001], w[1001], b[1001];
std::vector<int> V[1001];
int F(int x) { return f[x] == x ? x : f[x] = F(f[x]); }
int main() {
  scanf("%d%d%d", &N, &M, &W);
  for (int i = 1; i <= N; i++) scanf("%d", w + i);
  for (int i = 1; i <= N; i++) scanf("%d", b + i), f[i] = i;
  for (int i = 1, u, v; i <= M; i++) {
    scanf("%d%d", &u, &v);
    u = F(u);
    v = F(v);
    if (u != v) f[u] = v;
  }
  for (int i = 1; i <= N; i++) V[F(i)].push_back(i);
  for (int i = 0; i <= W; i++) f[i] = 0;
  for (int i = 1; i <= N; i++)
    if (V[i].size()) {
      int sw = 0, sb = 0;
      for (auto &j : V[i]) {
        sw += w[j];
        sb += b[j];
      }
      for (int j = W; j; j--) {
        for (auto &k : V[i])
          if (j >= w[k]) f[j] = std::max(f[j], f[j - w[k]] + b[k]);
        if (j >= sw) f[j] = std::max(f[j], f[j - sw] + sb);
      }
    }
  printf("%d\n", f[W]);
  return 0;
}
