#include <bits/stdc++.h>
using namespace std;
void solve();
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}
int we[1100];
int bu[1100];
int fa[1100];
int dp[1100];
int totalwe[1100];
int totalbu[1100];
vector<int> groups[1100];
int find_par(int x) { return fa[x] == x ? x : fa[x] = find_par(fa[x]); }
void solve() {
  int n, m, w;
  cin >> n >> m >> w;
  for (int i = 1; i <= n; i++) cin >> we[i], fa[i] = i;
  for (int i = 1; i <= n; i++) cin >> bu[i];
  for (int i = 1; i <= m; i++) {
    int xi, yi;
    cin >> xi >> yi;
    int t = find_par(xi);
    int l = find_par(yi);
    fa[t] = l;
  }
  for (int i = 1; i <= n; i++) {
    totalwe[find_par(i)] += we[i];
    totalbu[find_par(i)] += bu[i];
    groups[find_par(i)].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    if (fa[i] == i)
      for (int j = w; j >= 0; j--) {
        for (int u : groups[i]) {
          if (j >= we[u]) dp[j] = max(dp[j], dp[j - we[u]] + bu[u]);
        }
        if (j >= totalwe[i])
          dp[j] = max(dp[j], dp[j - totalwe[i]] + totalbu[i]);
      }
  }
  cout << dp[w] << endl;
}
