#include <bits/stdc++.h>
using namespace std;
int n, m, maxw;
int w[1010];
int b[1010];
int dsu[1010];
int DSU(int u) { return dsu[u] == u ? u : dsu[u] = DSU(dsu[u]); }
vector<pair<int, int> > ops[1010];
int dp[1010], newdp[1010];
int main() {
  scanf("%d%d%d", &n, &m, &maxw);
  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 <= n; ++i) {
    dsu[i] = i;
  }
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    u = DSU(u);
    v = DSU(v);
    dsu[v] = u;
  }
  for (int i = 1; i <= n; ++i) {
    ops[DSU(i)].push_back({w[i], b[i]});
  }
  for (int i = 1; i <= n; ++i) {
    if (i != DSU(i)) {
      w[DSU(i)] += w[i];
      b[DSU(i)] += b[i];
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (i == DSU(i)) {
      ops[i].push_back({w[i], b[i]});
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= maxw; ++j) {
      newdp[j] = dp[j];
    }
    for (pair<int, int> op : ops[i]) {
      for (int j = maxw; j >= 0; --j) {
        if (j + op.first <= maxw) {
          newdp[j + op.first] = max(newdp[j + op.first], dp[j] + op.second);
        }
      }
    }
    for (int j = 0; j <= maxw; ++j) {
      dp[j] = newdp[j];
    }
  }
  int res = 0;
  for (int i = 1; i <= maxw; ++i) {
    res = max(res, dp[i]);
  }
  printf("%d\n", res);
  return 0;
}
