#include <bits/stdc++.h>
using namespace std;
vector<int> G[1005];
int n, m, e, f[1005], b[1005], w[1005], sb[1005], sw[1005], F[1005], a[1005],
    la, ans;
int find(int x) { return f[x] ? f[x] = find(f[x]) : x; }
void work(int t) {
  int i, j;
  la = 0;
  for (i = 0; i < G[t].size(); i++) a[++la] = G[t][i];
  for (i = e; i >= 0; i--) {
    if (i >= sw[t]) F[i] = max(F[i], F[i - sw[t]] + sb[t]);
    for (j = 1; j <= la; j++)
      if (i >= w[a[j]]) F[i] = max(F[i], F[i - w[a[j]]] + b[a[j]]);
  }
}
int main() {
  int i, x, y;
  cin >> n >> m >> e;
  for (i = 1; i <= n; i++) scanf("%d", &w[i]), sw[i] = w[i];
  for (i = 1; i <= n; i++) scanf("%d", &b[i]), sb[i] = b[i];
  for (i = 1; i <= m; i++) {
    scanf("%d %d", &x, &y);
    x = find(x), y = find(y);
    if (x != y) sb[y] += sb[x], sw[y] += sw[x], f[x] = y;
  }
  for (i = 1; i <= n; i++) G[find(i)].push_back(i);
  for (i = 1; i <= n; i++)
    if (find(i) == i) work(i);
  for (i = 0; i <= e; i++) ans = max(ans, F[i]);
  cout << ans;
  return 0;
}
