#include <bits/stdc++.h>
using namespace std;
vector<int> vec[1010], id[1010];
int w[1010], b[1010], dp[1010], vis[1010], sum[1010], sum2[1010];
void dfs(int u, int id) {
  for (int i = 0; i < vec[u].size(); i++) {
    int v = vec[u][i];
    if (vis[v] == -1) {
      vis[v] = id;
      dfs(v, id);
    }
  }
}
int main() {
  int n, m, w2, u, v;
  while (cin >> n >> m >> w2) {
    for (int i = 1; i <= n; i++) {
      vec[i].clear();
      id[i].clear();
    }
    for (int i = 1; i <= n; i++) cin >> w[i];
    for (int i = 1; i <= n; i++) cin >> b[i];
    for (int i = 1; i <= m; i++) {
      cin >> u >> v;
      vec[u].push_back(v);
      vec[v].push_back(u);
    }
    memset(vis, -1, sizeof(vis));
    int g = 0;
    for (int i = 1; i <= n; i++) {
      if (vis[i] == -1) {
        g++;
        vis[i] = g;
        dfs(i, g);
      }
    }
    memset(sum, 0, sizeof(sum));
    memset(sum2, 0, sizeof(sum2));
    for (int i = 1; i <= n; i++) {
      id[vis[i]].push_back(i);
      sum[vis[i]] += w[i];
      sum2[vis[i]] += b[i];
    }
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= g; i++) {
      for (int j = w2; j >= 1; j--) {
        if (j >= sum[i]) {
          dp[j] = max(dp[j], dp[j - sum[i]] + sum2[i]);
        }
        for (int k = 0; k < id[i].size(); k++) {
          int v = id[i][k];
          if (j >= w[v]) dp[j] = max(dp[j], dp[j - w[v]] + b[v]);
        }
      }
    }
    int ans = 0;
    for (int i = 1; i <= w2; i++) ans = max(ans, dp[i]);
    cout << ans << endl;
  }
  return 0;
}
