#include <bits/stdc++.h>
using namespace std;
vector<long long> weight;
vector<long long> beauty;
vector<long long> vis;
vector<int> vec;
void dfs(int u, vector<long long> g[]) {
  vis[u] = 1;
  vec.push_back(u);
  for (int x : g[u])
    if (!vis[x]) dfs(x, g);
}
void solve() {
  long long n, m, w;
  cin >> n >> m >> w;
  vis = vector<long long>(n, 0);
  vector<long long> g[n];
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    weight.push_back(a);
  }
  for (long long i = 0; i < n; i++) {
    long long a;
    cin >> a;
    beauty.push_back(a);
  }
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<long long> dp(w + 1, INT_MIN);
  dp[0] = 0;
  for (int i = 0; i < n; i++)
    if (!vis[i]) {
      vec.clear();
      int dfsw = 0;
      int dfsb = 0;
      dfs(i, g);
      for (int each : vec) {
        dfsw += weight[each];
        dfsb += beauty[each];
      }
      for (int ww = w; ww >= 0; ww--) {
        for (int each : vec) {
          if (ww + weight[each] <= w) {
            dp[ww + weight[each]] =
                max(dp[ww + weight[each]], dp[ww] + beauty[each]);
          }
          if (dfsw + ww <= w) {
            dp[ww + dfsw] = max(dp[ww + dfsw], dp[ww] + dfsb);
          }
        }
      }
    }
  long long ans = dp[0];
  for (long long a : dp) {
    ans = max(ans, a);
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
