#include <bits/stdc++.h>
using namespace std;
int compNum = 0, w[1000], b[1000];
bool visited[1000] = {};
long long compTotW[1000] = {}, compTotB[1000] = {}, dp[1001] = {};
vector<int> adj[1000], comp[1000];
void dfs(int u) {
  comp[compNum].push_back(u);
  compTotW[compNum] += w[u];
  compTotB[compNum] += b[u];
  visited[u] = true;
  for (int v : adj[u])
    if (!visited[v]) dfs(v);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, W;
  cin >> n >> m >> W;
  for (int i = 0; i < n; i++) cin >> w[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x - 1].push_back(y - 1);
    adj[y - 1].push_back(x - 1);
  }
  for (int i = 0; i < n; i++)
    if (!visited[i]) {
      dfs(i);
      compNum++;
    }
  for (int i = 0; i < compNum; i++)
    for (int j = W; j >= 0; j--) {
      if (j >= compTotW[i])
        dp[j] = max(dp[j], dp[j - compTotW[i]] + compTotB[i]);
      for (int h : comp[i])
        if (j >= w[h]) dp[j] = max(dp[j], dp[j - w[h]] + b[h]);
    }
  cout << dp[W] << "\n";
  return 0;
}
