#include <bits/stdc++.h>
using namespace std;
int N, M, W;
int w[1000 + 5], b[1000 + 5], f[1000 + 5];
int wtotal[1000 + 5], btotal[1000 + 5];
int ans[1000 + 5];
vector<int> v[1000 + 5];
int find(int x) { return f[x] == x ? x : find(f[x]); }
int main() {
  cin >> N >> M >> W;
  for (int i = 1; i <= N; i++) cin >> w[i];
  for (int i = 1; i <= N; i++) cin >> b[i];
  for (int i = 0; i <= N; i++) f[i] = i;
  for (int i = 1, x, y; i <= M; i++) {
    cin >> x >> y;
    f[find(x)] = find(y);
  }
  for (int i = 1; i <= N; i++) {
    wtotal[find(i)] += w[i];
    btotal[find(i)] += b[i];
    v[find(i)].push_back(i);
  }
  for (int i = 1; i <= N; i++) {
    if (f[i] == i) {
      for (int j = W; j >= 0; j--) {
        for (int t = 0; t < v[i].size(); t++) {
          int current = v[i][t];
          if (j >= w[current])
            ans[j] = max(ans[j], ans[j - w[current]] + b[current]);
          if (j >= wtotal[i])
            ans[j] = max(ans[j], ans[j - wtotal[i]] + btotal[i]);
        }
      }
    }
  }
  cout << ans[W] << endl;
  return 0;
}
