#include <bits/stdc++.h>
using namespace std;
vector<int> val[1001];
vector<int> adj[1001];
int weight[1001];
int beauty[1001];
int idx = 1;
int visited[1001];
int dp[1001][1001];
void dfs(int u) {
  val[idx].push_back(u);
  visited[u] = 1;
  for (auto v : adj[u]) {
    if (!visited[v]) dfs(v);
  }
}
void solve() {
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 1; i < n + 1; i++) cin >> weight[i];
  for (int i = 1; i < n + 1; i++) cin >> beauty[i];
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i < n + 1; i++) {
    if (!visited[i]) {
      dfs(i);
      idx++;
    }
  }
  for (int i = 0; i < idx; i++) {
    for (int j = 0; j < w + 1; j++) {
      if (i == 0 || j == 0)
        dp[i][j] = 0;
      else {
        dp[i][j] = dp[i - 1][j];
        int curb = 0;
        int curw = 0;
        for (auto k : val[i]) {
          curb += beauty[k];
          curw += weight[k];
          if (j - weight[k] >= 0)
            dp[i][j] = max(dp[i][j], dp[i - 1][j - weight[k]] + beauty[k]);
        }
        if (j - curw >= 0) dp[i][j] = max(dp[i][j], dp[i - 1][j - curw] + curb);
      }
    }
  }
  cout << dp[idx - 1][w];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
