#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
const ll mod = ((ll)1e9) + 7;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(50);
  ll n, m, W;
  cin >> n >> m >> W;
  vl w(n), b(n);
  for (auto i = 0 * (n), i_len = (n); i < i_len; ++i) cin >> w[i];
  for (auto i = 0 * (n), i_len = (n); i < i_len; ++i) cin >> b[i];
  vvl path(n);
  for (auto i = 0 * (m), i_len = (m); i < i_len; ++i) {
    ll a, b;
    cin >> a >> b;
    a--, b--;
    path[a].push_back(b);
    path[b].push_back(a);
  }
  vector<vector<pair<ll, ll>>> pattern;
  vector<pair<ll, ll>> pattern2;
  vb visited(n, false);
  function<pair<ll, ll>(ll, ll)> dfs = [&](ll cur, ll prev) {
    if (visited[cur]) return make_pair(0ll, 0ll);
    visited[cur] = true;
    auto ret = make_pair(w[cur], b[cur]);
    pattern.back().push_back(ret);
    for (ll next : path[cur])
      if (prev != next) {
        auto p = dfs(next, cur);
        ret.first += p.first;
        ret.second += p.second;
      }
    return ret;
  };
  ll ans = 0;
  for (auto i = 0 * (n), i_len = (n); i < i_len; ++i)
    if (!visited[i]) {
      pattern.push_back(vector<pair<ll, ll>>());
      pattern.back().push_back(dfs(i, -1));
    }
  vvl dp(pattern.size() + 1, vl(W + 1, -1));
  dp[0][0] = 0;
  for (auto i = 0 * (pattern.size()), i_len = (pattern.size()); i < i_len;
       ++i) {
    for (auto j = 0 * (W + 1), j_len = (W + 1); j < j_len; ++j)
      if (dp[i][j] != -1) {
        dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
        for (auto&& p : pattern[i])
          if (W >= j + p.first) {
            dp[i + 1][j + p.first] =
                max(dp[i + 1][j + p.first], dp[i][j] + p.second);
          }
      }
  }
  for (auto i = 0 * (W + 1), i_len = (W + 1); i < i_len; ++i)
    ans = max(ans, dp[pattern.size()][i]);
  cout << ans << endl;
  return 0;
}
