#include <bits/stdc++.h>
using namespace std;
const int64_t N = 1001;
vector<vector<int64_t>> adj(N), elem(N);
vector<bool> vu(N);
int64_t crt_w = 0, crt_b = 0;
void dfs(int64_t idx, int64_t node, vector<int64_t>& w, vector<int64_t>& b) {
  vu[node] = true;
  crt_w += w[node];
  crt_b += b[node];
  elem[idx].emplace_back(node);
  for (auto i : adj[node]) {
    if (!vu[i]) dfs(idx, i, w, b);
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int64_t n, m, max_w;
  cin >> n >> m >> max_w;
  vector<int64_t> w(n), b(n);
  for (int64_t& i : w) cin >> i;
  for (int64_t& i : b) cin >> i;
  for (int64_t i = 0; i < m; ++i) {
    int64_t a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].emplace_back(b);
    adj[b].emplace_back(a);
  }
  vector<int64_t> W, B;
  int64_t idx = 0;
  for (int64_t i = 0; i < n; ++i) {
    if (!vu[i]) {
      crt_w = 0;
      crt_b = 0;
      dfs(idx, i, w, b);
      W.emplace_back(crt_w);
      B.emplace_back(crt_b);
      ++idx;
    }
  }
  vector<int64_t> dp(max_w + 1);
  vector<bool> ok(max_w + 1);
  int64_t ans = 0;
  ok[0] = true;
  for (int64_t i = 0; i < W.size(); ++i) {
    vector<int64_t> dp2 = dp;
    vector<bool> ok2 = ok;
    for (int64_t k : elem[i]) {
      for (int64_t j = max_w - w[k]; j >= 0; --j) {
        if (ok[j]) {
          ok2[j + w[k]] = true;
          dp2[j + w[k]] = max(dp2[j + w[k]], dp[j] + b[k]);
        }
      }
    }
    for (int64_t j = max_w - W[i]; j >= 0; --j) {
      if (ok[j]) {
        ok2[j + W[i]] = true;
        dp2[j + W[i]] = max(dp2[j + W[i]], dp[j] + B[i]);
      }
    }
    ok = ok2;
    dp = dp2;
  }
  for (int64_t i : dp) ans = max(ans, i);
  cout << ans;
  return 0;
}
