#include <bits/stdc++.h>
using namespace std;
long long n, m, W;
long long dp[1005], dp2[1005];
long long b[1005], w[1005];
long long par[1005];
vector<long long> v[1005];
long long find(long long u) { return u == par[u] ? u : par[u] = find(par[u]); }
void merge(long long a, long long b) {
  a = find(a), b = find(b);
  par[a] = find(b);
}
void solve() {
  cin >> n >> m >> W;
  for (long long i = 0; i < n; i++) par[i] = i;
  for (long long i = 0; i < n; i++) cin >> w[i];
  for (long long i = 0; i < n; i++) cin >> b[i];
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--, b--;
    merge(a, b);
  }
  for (long long i = 0; i < n; i++) v[find(i)].push_back(i);
  for (long long i = 0; i < n; i++) {
    long long totalW = 0, totalB = 0;
    for (long long k = 0; k < 1001; k++) dp2[k] = dp[k];
    for (long long j = 0; j < v[i].size(); j++) {
      totalW += w[v[i][j]];
      totalB += b[v[i][j]];
      for (long long k = 1001 - 1; k >= 0; k--) {
        if (k >= w[v[i][j]])
          dp2[k] = max(dp2[k], dp[k - w[v[i][j]]] + b[v[i][j]]);
      }
    }
    for (long long k = 1001 - 1; k >= 0; k--) {
      if (k >= totalW) dp2[k] = max(dp2[k], dp[k - totalW] + totalB);
    }
    for (long long k = 0; k < 1001; k++) dp[k] = dp2[k];
  }
  long long ans = 0;
  for (long long k = 0; k < W + 1; k++) {
    ans = max(ans, dp[k]);
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
