#include <bits/stdc++.h>
const double PI = acos(-1.0);
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const int MAXN = 1e3 + 10;
const long long MOD = 1e9 + 7;
const int dir[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int cases = 0;
int cnt, gw[MAXN], gb[MAXN], fa[MAXN], w[MAXN], b[MAXN];
std::vector<int> G[MAXN];
long long dp[MAXN];
int n;
int find(int u) { return fa[u] = (fa[u] == u ? u : find(fa[u])); }
void uni(int u, int v) {
  int x = find(u), y = find(v);
  if (x != y) {
    fa[x] = y;
    gw[y] += gw[x];
    gb[y] += gb[x];
  }
}
void solve() {
  for (int i = 1; i <= n; ++i) {
    G[find(i)].push_back(i);
  }
}
int main() {
  int m, ww;
  scanf("%d%d%d", &n, &m, &ww);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &w[i]);
    gw[i] = w[i];
    fa[i] = i;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
    gb[i] = b[i];
  }
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    uni(u, v);
  }
  solve();
  long long ans = 0;
  for (int i = 1; i <= n; ++i)
    if (!G[i].empty()) {
      for (int j = ww; j >= 0; --j) {
        if (j >= gw[i]) dp[j] = std::max(dp[j], dp[j - gw[i]] + gb[i]);
        for (int k = 0; k < G[i].size(); ++k) {
          int u = G[i][k];
          if (j >= w[u]) dp[j] = std::max(dp[j], dp[j - w[u]] + b[u]);
        }
        ans = std::max(ans, dp[j]);
      }
    }
  std::cout << ans << '\n';
  return 0;
}
